[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2] x86/PCI: Prefer MMIO over PIO on all hypervisor
- To: Vitaly Kuznetsov <vkuznets@xxxxxxxxxx>
- From: Ajay Kaher <akaher@xxxxxxxxxx>
- Date: Tue, 13 Sep 2022 12:47:47 +0000
- Accept-language: en-US
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=vmware.com; dmarc=pass action=none header.from=vmware.com; dkim=pass header.d=vmware.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=+1kM91Agf12XoqrQQtWbE4p8Mh3i7XKkWF6wocbZT10=; b=AhfBu1t1gCQfhnwpkv5AWFm1CCwEindEAB+3yav0C2Ic7Cm4xM0V5jjkPKdV/bLus2PPqnbZo7yDxrnsO6TRbIzGdzWpDuhVLxmIz7Pyl53v2Nb8p/Yo/nUaJULKSaX1S82HaE6iUMJejT1C2v/CkmskwZZOAWVPOLi0pzf3vf4AvVS0PukuYlS+DJKPNi6iA2unz41thbmC3Gw0AVYhSWgKaHVCT5+ejQMmyxxOGREGzSUTuROBcyoPNXj3YGpMUJAVyCRYOS+k1et+Iz7e/9awHxdp99PTBj5Ooepg/ZndWFB+93kpjvulDTQX+ynKsAsir9M63NRwQ0BbUeszDg==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JtJpkbfq49CR2jtKrSjJ/4RMcsn+F8k2+MFY5KM6Wm0timcEqozRLg8BfpTtl8W+PkMYcqSoAE+hIVToQEycYt3ajw5aS/xzKn18Y5ySX2RBL6LnvuzubfBJRDdoio7LGn/1GMDwVIvnhxr5f2umJVyirZ6G/zZUR9b3gzWUZWos6V79HdPrf2BlT2mb7nOeNgb0KvHw5zkC1/e6SzMZiq7exopADAYb7ckrOf5MHx+AypAvGBefvKntMLjrGTy4DDmR0auy63slDvbGUQM/3HQ+bXOCzSrX3TtmxeST5qgqcN4YqTciCuzhDdKD3pGLmgDAQEO6fFoLkGju+UmjDA==
- Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vmware.com;
- Cc: "x86@xxxxxxxxxx" <x86@xxxxxxxxxx>, "hpa@xxxxxxxxx" <hpa@xxxxxxxxx>, "linux-pci@xxxxxxxxxxxxxxx" <linux-pci@xxxxxxxxxxxxxxx>, "linux-kernel@xxxxxxxxxxxxxxx" <linux-kernel@xxxxxxxxxxxxxxx>, "rostedt@xxxxxxxxxxx" <rostedt@xxxxxxxxxxx>, Srivatsa Bhat <srivatsab@xxxxxxxxxx>, "srivatsa@xxxxxxxxxxxxx" <srivatsa@xxxxxxxxxxxxx>, Alexey Makhalov <amakhalov@xxxxxxxxxx>, Vasavi Sirnapalli <vsirnapalli@xxxxxxxxxx>, "er.ajay.kaher@xxxxxxxxx" <er.ajay.kaher@xxxxxxxxx>, "willy@xxxxxxxxxxxxx" <willy@xxxxxxxxxxxxx>, Nadav Amit <namit@xxxxxxxxxx>, "linux-hyperv@xxxxxxxxxxxxxxx" <linux-hyperv@xxxxxxxxxxxxxxx>, "kvm@xxxxxxxxxxxxxxx" <kvm@xxxxxxxxxxxxxxx>, "jailhouse-dev@xxxxxxxxxxxxxxxx" <jailhouse-dev@xxxxxxxxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, "acrn-dev@xxxxxxxxxxxxxxxxxxxxx" <acrn-dev@xxxxxxxxxxxxxxxxxxxxx>, "helgaas@xxxxxxxxxx" <helgaas@xxxxxxxxxx>, "bhelgaas@xxxxxxxxxx" <bhelgaas@xxxxxxxxxx>, "tglx@xxxxxxxxxxxxx" <tglx@xxxxxxxxxxxxx>, "mingo@xxxxxxxxxx" <mingo@xxxxxxxxxx>, "bp@xxxxxxxxx" <bp@xxxxxxxxx>, "dave.hansen@xxxxxxxxxxxxxxx" <dave.hansen@xxxxxxxxxxxxxxx>, Alexander Graf <graf@xxxxxxxxxx>
- Delivery-date: Tue, 13 Sep 2022 12:48:23 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
- Thread-index: AQHYx28G+J2WSwxm3kmFzqoOhSDYUA==
- Thread-topic: [PATCH v2] x86/PCI: Prefer MMIO over PIO on all hypervisor
Note: Corrected the Subject.
> On 07/09/22, 8:50 PM, "Vitaly Kuznetsov" <vkuznets@xxxxxxxxxx> wrote:
>
>> diff --git a/arch/x86/pci/common.c b/arch/x86/pci/common.c
>> index ddb7986..1e5a8f7 100644
>> --- a/arch/x86/pci/common.c
>> +++ b/arch/x86/pci/common.c
>> @@ -20,6 +20,7 @@
>> #include <asm/pci_x86.h>
>> #include <asm/setup.h>
>> #include <asm/irqdomain.h>
>> +#include <asm/hypervisor.h>
>>
>> unsigned int pci_probe = PCI_PROBE_BIOS | PCI_PROBE_CONF1 | PCI_PROBE_CONF2
>> |
>> PCI_PROBE_MMCONF;
>> @@ -57,14 +58,58 @@ int raw_pci_write(unsigned int domain, unsigned int bus,
>> unsigned int devfn,
>> return -EINVAL;
>> }
>>
>> +#ifdef CONFIG_HYPERVISOR_GUEST
>> +static int vm_raw_pci_read(unsigned int domain, unsigned int bus, unsigned
>> int devfn,
>> + int reg, int len, u32 *val)
>> +{
>> + if (raw_pci_ext_ops)
>> + return raw_pci_ext_ops->read(domain, bus, devfn, reg, len,
>> val);
>> + if (domain == 0 && reg < 256 && raw_pci_ops)
>> + return raw_pci_ops->read(domain, bus, devfn, reg, len, val);
>> + return -EINVAL;
>> +}
>> +
>> +static int vm_raw_pci_write(unsigned int domain, unsigned int bus, unsigned
>> int devfn,
>> + int reg, int len, u32 val)
>> +{
>> + if (raw_pci_ext_ops)
>> + return raw_pci_ext_ops->write(domain, bus, devfn, reg, len,
>> val);
>> + if (domain == 0 && reg < 256 && raw_pci_ops)
>> + return raw_pci_ops->write(domain, bus, devfn, reg, len, val);
>> + return -EINVAL;
>> +}
>
> These look exactly like raw_pci_read()/raw_pci_write() but with inverted
> priority. We could've added a parameter but to be more flexible, I'd
> suggest we add a 'priority' field to 'struct pci_raw_ops' and make
> raw_pci_read()/raw_pci_write() check it before deciding what to use
> first. To be on the safe side, you can leave raw_pci_ops's priority
> higher than raw_pci_ext_ops's by default and only tweak it in
> arch/x86/kernel/cpu/vmware.c
Thanks Vitaly for your response.
1. we have multiple objects of struct pci_raw_ops, 2. adding 'priority' field
to struct pci_raw_ops
doesn't seems to be appropriate as need to take decision which object of struct
pci_raw_ops has
to be used, not something with-in struct pci_raw_ops.
It's a generic solution for all hypervisor (sorry for earlier wrong Subject),
not specific to VMware.
Further looking for feedback if it's impacting to any hypervisor.
-Ajay
|