All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Chen, Tiejun" <tiejun.chen@intel.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: xen-devel@lists.xensource.com, allen.m.kay@intel.com,
	qemu-devel@nongnu.org, aliguori@amazon.com, pbonzini@redhat.com,
	rth@twiddle.net
Subject: Re: [Qemu-devel] [RFC][PATCH 2/2] xen:i386:pc_piix: create isa bridge specific to IGD passthrough
Date: Mon, 17 Nov 2014 19:18:17 +0800	[thread overview]
Message-ID: <5469D979.8050404@intel.com> (raw)
In-Reply-To: <20141117101342.GF20133@redhat.com>

On 2014/11/17 18:13, Michael S. Tsirkin wrote:
> On Mon, Nov 17, 2014 at 05:42:12PM +0800, Chen, Tiejun wrote:
>> On 2014/11/17 17:25, Michael S. Tsirkin wrote:
>>> On Mon, Nov 17, 2014 at 04:48:32PM +0800, Chen, Tiejun wrote:
>>>> On 2014/11/17 14:10, Michael S. Tsirkin wrote:
>>>>> On Mon, Nov 17, 2014 at 10:47:56AM +0800, Chen, Tiejun wrote:
>>>>>> On 2014/11/5 22:09, Michael S. Tsirkin wrote:
>>>>>>> On Wed, Nov 05, 2014 at 03:22:59PM +0800, Tiejun Chen wrote:
>>>>>>>> Currently IGD drivers always need to access PCH by 1f.0, and
>>>>>>>> PCH vendor/device id is used to identify the card.
>>>>>>>>
>>>>>>>> Signed-off-by: Tiejun Chen <tiejun.chen@intel.com>
>>>>>>>> ---
>>
>> [snip]
>>
>>> Cleaner:
>>> 	 if (!pci_dev) {
>>> 		fprintf
>>> 		return;
>>> 	}
>>>           pci_config_set_device_id(pci_dev->config, pch_id);
>>
>> I will address all comments and thanks.
>>
>>>
>>>> +    }
>>>> +}
>>>> +
>>>>   /* init */
>>>>
>>>>   static int xen_pt_initfn(PCIDevice *d)
>>>> @@ -682,6 +770,9 @@ static int xen_pt_initfn(PCIDevice *d)
>>>>           return -1;
>>>>       }
>>>>
>>>> +    /* Register ISA bridge for passthrough GFX. */
>>>> +    xen_igd_passthrough_isa_bridge_create(s, &s->real_device);
>>>> +
>>>>       /* reinitialize each config register to be emulated */
>>>>       if (xen_pt_config_init(s)) {
>>>>           XEN_PT_ERR(d, "PCI Config space initialisation failed.\n");
>>>>
>>>> Note I will introduce a inline function in another patch,
>>>>
>>>> +static inline int is_vga_passthrough(XenHostPCIDevice *dev)
>>>> +{
>>>> +    return (xen_has_gfx_passthru && (dev->vendor_id == PCI_VENDOR_ID_INTEL)
>>>> +            && ((dev->class_code >> 0x8) == PCI_CLASS_DISPLAY_VGA));
>>>> +}
>>>>
>>>> Thanks
>>>> Tiejun
>>>
>>> Why bother with all these conditions?
>>> Won't it be enough to check dev->vendor_id == PCI_VENDOR_ID_INTEL?
>>>
>>
>> If this is just used for IGD, its always fine without checking vendor_id.
>
> You need to match device ID to *know* it's IGD.
>
>> So after remove that check, I guess I need to rename that as
>> is_igd_vga_passthrough() to make sense.
>>
>> Thanks
>> Tiejun
>
> There is no need to check class code or xen_has_gfx_passthru flag.
> Device ID + vendor ID identifies each device uniquely.
>

Yeah.

Here I assume vendor ID is always PCI_VENDOR_ID_INTEL so looks you means 
I also need to check that table to do something like,

is_igd_vga_passthugh(dev)
{	
	int i;
	int num = ARRAY_SIZE(xen_igd_combo_id_infos);
	for (i = 0; i < num; i++) {
		if (dev->device_id == xen_igd_combo_id_infos[i].gpu_device_id)
			return 1;
	return 0;
}

Then we can simplify the subsequent codes based on this, right?

Thanks
Tiejun

WARNING: multiple messages have this Message-ID (diff)
From: "Chen, Tiejun" <tiejun.chen@intel.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: xen-devel@lists.xensource.com, allen.m.kay@intel.com,
	qemu-devel@nongnu.org, aliguori@amazon.com, pbonzini@redhat.com,
	rth@twiddle.net
Subject: Re: [RFC][PATCH 2/2] xen:i386:pc_piix: create isa bridge specific to IGD passthrough
Date: Mon, 17 Nov 2014 19:18:17 +0800	[thread overview]
Message-ID: <5469D979.8050404@intel.com> (raw)
In-Reply-To: <20141117101342.GF20133@redhat.com>

On 2014/11/17 18:13, Michael S. Tsirkin wrote:
> On Mon, Nov 17, 2014 at 05:42:12PM +0800, Chen, Tiejun wrote:
>> On 2014/11/17 17:25, Michael S. Tsirkin wrote:
>>> On Mon, Nov 17, 2014 at 04:48:32PM +0800, Chen, Tiejun wrote:
>>>> On 2014/11/17 14:10, Michael S. Tsirkin wrote:
>>>>> On Mon, Nov 17, 2014 at 10:47:56AM +0800, Chen, Tiejun wrote:
>>>>>> On 2014/11/5 22:09, Michael S. Tsirkin wrote:
>>>>>>> On Wed, Nov 05, 2014 at 03:22:59PM +0800, Tiejun Chen wrote:
>>>>>>>> Currently IGD drivers always need to access PCH by 1f.0, and
>>>>>>>> PCH vendor/device id is used to identify the card.
>>>>>>>>
>>>>>>>> Signed-off-by: Tiejun Chen <tiejun.chen@intel.com>
>>>>>>>> ---
>>
>> [snip]
>>
>>> Cleaner:
>>> 	 if (!pci_dev) {
>>> 		fprintf
>>> 		return;
>>> 	}
>>>           pci_config_set_device_id(pci_dev->config, pch_id);
>>
>> I will address all comments and thanks.
>>
>>>
>>>> +    }
>>>> +}
>>>> +
>>>>   /* init */
>>>>
>>>>   static int xen_pt_initfn(PCIDevice *d)
>>>> @@ -682,6 +770,9 @@ static int xen_pt_initfn(PCIDevice *d)
>>>>           return -1;
>>>>       }
>>>>
>>>> +    /* Register ISA bridge for passthrough GFX. */
>>>> +    xen_igd_passthrough_isa_bridge_create(s, &s->real_device);
>>>> +
>>>>       /* reinitialize each config register to be emulated */
>>>>       if (xen_pt_config_init(s)) {
>>>>           XEN_PT_ERR(d, "PCI Config space initialisation failed.\n");
>>>>
>>>> Note I will introduce a inline function in another patch,
>>>>
>>>> +static inline int is_vga_passthrough(XenHostPCIDevice *dev)
>>>> +{
>>>> +    return (xen_has_gfx_passthru && (dev->vendor_id == PCI_VENDOR_ID_INTEL)
>>>> +            && ((dev->class_code >> 0x8) == PCI_CLASS_DISPLAY_VGA));
>>>> +}
>>>>
>>>> Thanks
>>>> Tiejun
>>>
>>> Why bother with all these conditions?
>>> Won't it be enough to check dev->vendor_id == PCI_VENDOR_ID_INTEL?
>>>
>>
>> If this is just used for IGD, its always fine without checking vendor_id.
>
> You need to match device ID to *know* it's IGD.
>
>> So after remove that check, I guess I need to rename that as
>> is_igd_vga_passthrough() to make sense.
>>
>> Thanks
>> Tiejun
>
> There is no need to check class code or xen_has_gfx_passthru flag.
> Device ID + vendor ID identifies each device uniquely.
>

Yeah.

Here I assume vendor ID is always PCI_VENDOR_ID_INTEL so looks you means 
I also need to check that table to do something like,

is_igd_vga_passthugh(dev)
{	
	int i;
	int num = ARRAY_SIZE(xen_igd_combo_id_infos);
	for (i = 0; i < num; i++) {
		if (dev->device_id == xen_igd_combo_id_infos[i].gpu_device_id)
			return 1;
	return 0;
}

Then we can simplify the subsequent codes based on this, right?

Thanks
Tiejun

  reply	other threads:[~2014-11-17 11:18 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-05  7:22 [Qemu-devel] [RFC][PATCH 1/2] hw:xen:xen_pt: register isa bridge specific to IGD passthrough Tiejun Chen
2014-11-05  7:22 ` Tiejun Chen
2014-11-05  7:22 ` [Qemu-devel] [RFC][PATCH 2/2] xen:i386:pc_piix: create " Tiejun Chen
2014-11-05  7:22   ` Tiejun Chen
2014-11-05 14:09   ` [Qemu-devel] " Michael S. Tsirkin
2014-11-05 14:09     ` Michael S. Tsirkin
2014-11-17  2:47     ` [Qemu-devel] " Chen, Tiejun
2014-11-17  2:47       ` Chen, Tiejun
2014-11-17  6:10       ` [Qemu-devel] " Michael S. Tsirkin
2014-11-17  6:10         ` Michael S. Tsirkin
2014-11-17  8:48         ` [Qemu-devel] " Chen, Tiejun
2014-11-17  8:48           ` Chen, Tiejun
2014-11-17  9:25           ` [Qemu-devel] " Michael S. Tsirkin
2014-11-17  9:25             ` Michael S. Tsirkin
2014-11-17  9:42             ` [Qemu-devel] " Chen, Tiejun
2014-11-17  9:42               ` Chen, Tiejun
2014-11-17 10:13               ` [Qemu-devel] " Michael S. Tsirkin
2014-11-17 10:13                 ` Michael S. Tsirkin
2014-11-17 11:18                 ` Chen, Tiejun [this message]
2014-11-17 11:18                   ` Chen, Tiejun
2014-11-17 12:10                   ` [Qemu-devel] " Michael S. Tsirkin
2014-11-17 12:10                     ` Michael S. Tsirkin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5469D979.8050404@intel.com \
    --to=tiejun.chen@intel.com \
    --cc=aliguori@amazon.com \
    --cc=allen.m.kay@intel.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.