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

Re: [PATCH v14 5/5] arm/vpci: honor access size when returning an error


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Stewart Hildebrand <stewart.hildebrand@xxxxxxx>
  • Date: Wed, 15 May 2024 11:23:47 -0400
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=suse.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • 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=UzRJOqZMNHQhajyVvCP+iCeSVE5aHh1KCTZRWHK+bPI=; b=S3DG30MLhZeauuuMi7lbvpVaYDZCwVuGJODU3VGfF/iQM95m+9CfQhFQSAXHLIijDZF/pJh83B9xWxvfoQIm1+A2l2SVCQ3awL6s2SCxLiRip+iZmbFJrg4fVY7wbpU6bjbmnIknrCKr4mBzJnTRAyHnwRVCSiva+Wl8Mh0R4SB6ejAjae7r8wl4+Rd5FQvNP/5/wrfplxFW34welByTpwKZFD1qob+iWxTI8BsGI8PIKiStlzew6g0CejuCssiZqHXg+fORo6DnD684Ty0fCkKp6nvFEpAAdowGKYSuLPTFeXnunP8OGRWPWYYG9byuUaNL2jdE5HJaKP9nRvxoBQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oJ9AAeVPJuQpISXGpV31MYInpFq4wjJPCjyadebfdJjk76uSrbdUmIMMJlIXHKsJsb8TZ1ym0csngMwljG/Lc+/bizMg6whtduY1PkcHNxH6Vxx7sp8f+oW6+P70dBSa7QhBEzid1PUUNJV3xaiJv/g+rhxv+uWt5l8Kc74rR948xM37JU3xDG0J3LuLRLnA5t5xx15IqE7cqvgCalE+RO1i9vWSXSr5NlepnHk5GsiR7fWv5z2pGRfteDKEezTXRTU3/+rwPOu5G1P7KQjl7E8Mlt8Q4PJVdjc5CeW/vVnIiW60MUjI66B4dWZakgWYNoGbQ3L33TICiwcz8g8RdA==
  • Cc: Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Julien Grall <julien@xxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Wed, 15 May 2024 15:23:56 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 5/15/24 02:32, Jan Beulich wrote:
> On 14.05.2024 22:31, Stewart Hildebrand wrote:
>> Here's what the patch ("arm/vpci: honor access size when returning an
>> error") now looks like based on staging:
>>
>> diff --git a/xen/arch/arm/vpci.c b/xen/arch/arm/vpci.c
>> index 3bc4bb55082a..31e9e1d20751 100644
>> --- a/xen/arch/arm/vpci.c
>> +++ b/xen/arch/arm/vpci.c
>> @@ -29,6 +29,8 @@ static int vpci_mmio_read(struct vcpu *v, mmio_info_t 
>> *info,
>>  {
>>      struct pci_host_bridge *bridge = p;
>>      pci_sbdf_t sbdf = vpci_sbdf_from_gpa(bridge, info->gpa);
>> +    const uint8_t access_size = (1U << info->dabt.size) * 8;
> 
> And why exactly uint8_t here, rather than unsigned int? See ./CODING_STYLE.

I'll change to unsigned int.

> 
>> +    const uint64_t invalid = GENMASK_ULL(access_size - 1, 0);
> 
> I'm not entirely convinced of uint64_t here either, but I'd view this as
> more borderline than the uint8_t above. As per ...
> 
>> @@ -39,7 +41,7 @@ static int vpci_mmio_read(struct vcpu *v, mmio_info_t 
>> *info,
>>          return 1;
>>      }
>>  
>> -    *r = ~0ul;
>> +    *r = invalid;
> 
> ... the original rhs here, unsigned long (or perhaps register_t) would seem
> more appropriate, but I have no idea whether on Arm32 info->dabt.size can
> end up being 3.

Well, it depends which spec we look at. In the ARMv7 ARM, 3 is reserved.
But in the ARMv8 ARM, in the aarch32 section, 3 appears to be valid...

Anyway, since the value returned in r can only be as wide as register_t
due to the way our mmio handlers are implemented, I'll change to
register_t for now to match the lhs.



 


Rackspace

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