<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<p><br>
</p>
<meta content="text/html; charset=UTF-8">
<div dir="ltr">
<div id="x_divtagdefaultwrapper" dir="ltr" style="font-size: 12pt; color: rgb(0, 0, 0); font-family: Calibri, Helvetica, sans-serif, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols;">
<p></p>
<div style="font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols; font-size:16px">
></div>
<div style="font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols; font-size:16px">
>From: Chris Wilson <chris@chris-wilson.co.uk></div>
<div style="font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols; font-size:16px">
>Sent: Monday, December 14, 2020 12:48 PM</div>
<div style="font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols; font-size:16px">
>To: Chang, Yu bruce; intel-gfx@lists.freedesktop.org</div>
<div style="font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols; font-size:16px">
>Cc: igt-dev@</div>
<div style="font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols; font-size:16px">
>Subject: Re: [Intel-gfx] [PATCH i-g-t] lib: Pass device fd to gem_mmappable_aperture_size()</div>
<div style="font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols; font-size:16px">
> </div>
<div style="font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols; font-size:16px">
>Quoting Chang, Yu bruce (2020-12-14 18:45:04)</div>
<div style="font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols; font-size:16px">
>> +/**</div>
<div style="font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols; font-size:16px">
>> + * gem_mappable_aperture_size:</div>
<div style="font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols; font-size:16px">
>> + *</div>
<div style="font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols; font-size:16px">
>> + * Feature test macro to query the kernel for the mappable gpu aperture size.</div>
<div style="font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols; font-size:16px">
>> + * This is the area available for GTT memory mappings.</div>
<div style="font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols; font-size:16px">
>> + *</div>
<div style="font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols; font-size:16px">
> + * Returns: The mappable gtt address space size.</div>
<div style="font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols; font-size:16px">
> + */</div>
<div style="font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols; font-size:16px">
> +uint64_t gem_mappable_aperture_size(int fd)</div>
<div style="font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols; font-size:16px">
> +{</div>
<div style="font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols; font-size:16px">
> + struct pci_device *pci_dev = igt_device_get_pci_device(fd);</div>
<div style="font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols; font-size:16px">
> </div>
<div style="font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols; font-size:16px">
> Does it make sense to eliminate the function intel_get_pci_device() if not</div>
<div style="font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols; font-size:16px">
> being used anymore? But it can be a separate patch.</div>
<div style="font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols; font-size:16px">
></div>
<div style="font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols; font-size:16px">
>It's still used by tools. The complication there is that we mostly</div>
<div style="font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols; font-size:16px">
>need to lookup the pci device without loading i915.ko. </div>
<div style="font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols; font-size:16px">
>-Chris</div>
<div style="font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols; font-size:16px">
></div>
<div style="font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols; font-size:16px">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols; font-size:16px">
<font size="2"><span style="font-size:10pt">
<div class="x_PlainText"><span style="font-size:12pt; font-family:Calibri,Helvetica,sans-serif">That makes sense.</span></div>
<div class="x_PlainText"><br>
</div>
<div class="x_PlainText"><span style="font-size:16px"><span style="font-size:12pt; font-family:Calibri,Helvetica,sans-serif">Then we need to make sure not start from a fix slot to look for GPU device </span><span style="font-size:12pt; font-family:Calibri,Helvetica,sans-serif">in
the </span><span style="font-size:12pt; font-family:Calibri,Helvetica,sans-serif">intel_get_pci_device() below as</span></span></div>
<div class="x_PlainText"><span style="font-size:16px"><span style="font-size:12pt; font-family:Calibri,Helvetica,sans-serif">it </span><span style="font-size:12pt; font-family:Calibri,Helvetica,sans-serif">may not work for a discrete GPU as that slot can be
a non-vga device but with <i style="font-family:Calibri,Helvetica,sans-serif; font-size:16px">vendor_id 0x8086</i>.</span></span><span style="font-size:10pt"></span></div>
<div class="x_PlainText"><span style="font-size:16px"><span style="font-size:12pt; font-family:Calibri,Helvetica,sans-serif"><br>
</span></span></div>
<div class="x_PlainText"><span style="font-size:16px"><span style="font-size:12pt; font-family:Calibri,Helvetica,sans-serif">
<div><i> pci_dev = pci_device_find_by_slot(0, 0, 2, 0);</i></div>
<div><i><span style="white-space:pre"></span> if (pci_dev == NULL || pci_dev->vendor_id != 0x8086) {</i></div>
<br>
</span></span></div>
<div class="x_PlainText"><span style="font-size:16px"><span style="font-size:12pt; font-family:Calibri,Helvetica,sans-serif">So, either add extra check to make sure it is VGA class or always use <span>pci_device_next to search.</span></span></span></div>
<div class="x_PlainText"><span style="font-size:16px"><span style="font-size:10pt"><br>
</span></span></div>
<div class="x_PlainText"><span style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt">Thanks,</span><br>
</div>
<div class="x_PlainText"><span style="font-size:16px"><span style="font-size:12pt; font-family:Calibri,Helvetica,sans-serif">-Bruce</span></span></div>
</span></font></div>
<br>
<p></p>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="x_divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> Chris Wilson <chris@chris-wilson.co.uk><br>
<b>Sent:</b> Monday, December 14, 2020 12:48:40 PM<br>
<b>To:</b> Chang, Yu bruce; intel-gfx@lists.freedesktop.org<br>
<b>Cc:</b> igt-dev@<br>
<b>Subject:</b> Re: [Intel-gfx] [PATCH i-g-t] lib: Pass device fd to gem_mmappable_aperture_size()</font>
<div> </div>
</div>
</div>
<font size="2"><span style="font-size:10pt">
<div class="PlainText">Quoting Chang, Yu bruce (2020-12-14 18:45:04)<br>
> +/**<br>
> + * gem_mappable_aperture_size:<br>
> + *<br>
> + * Feature test macro to query the kernel for the mappable gpu aperture size.<br>
> + * This is the area available for GTT memory mappings.<br>
> + *<br>
> + * Returns: The mappable gtt address space size.<br>
> + */<br>
> +uint64_t gem_mappable_aperture_size(int fd)<br>
> +{<br>
> + struct pci_device *pci_dev = igt_device_get_pci_device(fd);<br>
> <br>
> Does it make sense to eliminate the function intel_get_pci_device() if not<br>
> being used anymore? But it can be a separate patch.<br>
<br>
It's still used by tools. The complication there is that we mostly<br>
need to lookup the pci device without loading i915.ko. <br>
-Chris<br>
</div>
</span></font></div>
</body>
</html>