[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH-4.16 v2] xen/arm: fix SBDF calculation for vPCI MMIO handlers


  • To: Stefano Stabellini <sstabellini@xxxxxxxxxx>, "iwj@xxxxxxxxxxxxxx" <iwj@xxxxxxxxxxxxxx>
  • From: Oleksandr Andrushchenko <Oleksandr_Andrushchenko@xxxxxxxx>
  • Date: Wed, 3 Nov 2021 12:08:14 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=epam.com; dmarc=pass action=none header.from=epam.com; dkim=pass header.d=epam.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=REI/WpvKUKqYAogjMFToRl21uitvTldv8bIf4KCD5U8=; b=PwKb6myDpu+6Our4982Eo3KoAk3myBn8/S6mgtgVH9tY81xd2akGzExuRFCZNtn4S5Eh/5Oh3Ia6/X/CGDaqb35hfV9kwyL1pQHX6PsTFh64CmRb55X5l1AhHybb7ac9ndxJ4Cr+tkW3CGQuCtxVlNQ5TOAOn/fVVOtS/ULmb4OSe0fojYp38efzBrnRzhFdajnpjUXDe4ENt6sB57wTPklbAGYVENuK4Bh5VXVPdrQxSbdUzciwP6GgqA5G+piswLA2qdBXpoZkE5RTrD4eszOo2PWmdeH3+DTzXQIytfAaf6S/Tc0OVRBjyK9uTsWvLT+TsqPQjqJ8dK0iYbh23w==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=K7muP0Et1914Ws7lidDt500B55p9HBym0edED7aBO/fYU/uPUa4xZhw+tRSeLyo1XbuYgnNbCyNiNpDSZMb9HllA6sUq1G0JgAwThJ56sVz7vZgzBS4YQzJsglbwUjh/lC9M4fgRYO76wzghZVhVhRA+SHlmwGTkRXx2DdIpikeUf8uBFAMT9u6IrMBsx7oOlAfxB1EB71MnKIFXrqMJX684UvAhj9WBMi6FSrPfPskxjVkeMTY/xXbJ89q4Bf/7ZQ2XO9umKKTvOGyY31JZUeQjHO/UQWIzsxch3wWn2wt5Ows7d5+Y/2VTnHsw95JuhZcmJ41pHyjMOvqE8s13bg==
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, "julien@xxxxxxx" <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Rahul Singh <rahul.singh@xxxxxxx>
  • Delivery-date: Wed, 03 Nov 2021 12:08:48 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHXz9uvpkVSL/P+h0KvYyBzgfugSKvw16AAgADfnQA=
  • Thread-topic: [PATCH-4.16 v2] xen/arm: fix SBDF calculation for vPCI MMIO handlers


On 03.11.21 00:47, Stefano Stabellini wrote:
> On Tue, 2 Nov 2021, Oleksandr Andrushchenko wrote:
>> From: Oleksandr Andrushchenko <oleksandr_andrushchenko@xxxxxxxx>
>>
>> While in vPCI MMIO trap handlers for the guest PCI host bridge it is not
>> enough for SBDF translation to simply call VPCI_ECAM_BDF(info->gpa) as
>> the base address may not be aligned in the way that the translation
>> always work. If not adjusted with respect to the base address it may not be
>> able to properly convert SBDF.
>> Fix this by adjusting the gpa with respect to the host bridge base address
>> in a way as it is done for x86.
>>
>> Please note, that this change is not strictly required given the current
>> value of GUEST_VPCI_ECAM_BASE which has bits 0 to 27 clear, but could cause
>> issues if such value is changed, or when handlers for dom0 ECAM
>> regions are added as those will be mapped over existing hardware
>> regions that could use non-aligned base addresses.
>>
>> Fixes: d59168dc05a5 ("xen/arm: Enable the existing x86 virtual PCI support 
>> for ARM")
>>
>> Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@xxxxxxxx>
> Acked-by: Stefano Stabellini <sstabellini@xxxxxxxxxx>
>
> Also, Ian already gave his release-ack.
Thank you,
Do I need to resend the patch with Acks? Or hopefully those can be applied
on commit?
>
>
>> ---
>> Since v1:
>>   - updated commit message (Roger)
>>
>> This patch aims for 4.16 release.
>> Benefits:
>> Fix potential bug and clear the way for further PCI passthrough
>> development.
>> Risks:
>> None as the change doesn't change the behaviour of the current code,
>> but brings clarity into SBDF calculation.
>> ---
>>   xen/arch/arm/vpci.c | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/xen/arch/arm/vpci.c b/xen/arch/arm/vpci.c
>> index 8f40a0dec6d2..23f45386f4b3 100644
>> --- a/xen/arch/arm/vpci.c
>> +++ b/xen/arch/arm/vpci.c
>> @@ -24,7 +24,7 @@ static int vpci_mmio_read(struct vcpu *v, mmio_info_t 
>> *info,
>>       unsigned long data;
>>   
>>       /* We ignore segment part and always handle segment 0 */
>> -    sbdf.sbdf = VPCI_ECAM_BDF(info->gpa);
>> +    sbdf.sbdf = VPCI_ECAM_BDF(info->gpa - GUEST_VPCI_ECAM_BASE);
>>   
>>       if ( vpci_ecam_read(sbdf, ECAM_REG_OFFSET(info->gpa),
>>                           1U << info->dabt.size, &data) )
>> @@ -44,7 +44,7 @@ static int vpci_mmio_write(struct vcpu *v, mmio_info_t 
>> *info,
>>       pci_sbdf_t sbdf;
>>   
>>       /* We ignore segment part and always handle segment 0 */
>> -    sbdf.sbdf = VPCI_ECAM_BDF(info->gpa);
>> +    sbdf.sbdf = VPCI_ECAM_BDF(info->gpa - GUEST_VPCI_ECAM_BASE);
>>   
>>       return vpci_ecam_write(sbdf, ECAM_REG_OFFSET(info->gpa),
>>                              1U << info->dabt.size, r);
>> -- 
>> 2.25.1
>>

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.