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

Re: [PATCH v7 1/2] xen/vpci: header: status register handler


  • To: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • From: Stewart Hildebrand <stewart.hildebrand@xxxxxxx>
  • Date: Tue, 21 Nov 2023 10:03:01 -0500
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=citrix.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=AZjCeIViNFPBeWOfwkFNr1a8tUg1r3zE/BcwzWJzM4U=; b=bV/wzm/db4TAyfm/pFMUTawLpZbSGIGeKqks4J/Azk7eIZvJdOW16bxlGoIxuXYVAAJfuNaJXRGfXxNBnf8DowOJbi8kHgWVaTReOxMtFmMb6PMP8kctjxl3P7Az/9UW+hjsKHETRJs3NmK8sXbv9uibFbPXQom/5vBpuxMnQ1YxxSSsTaoYf1rAytI2CPRbQyvZASkp4lCVQKHtvPILW8dnvMVM6ibUC+60/YPY46TbB2x6s9xQ0Rkisy5wHat7otDfVsEYLF/idKIxj36iaQNUWJvptvKc0ObxyM+/4ftVIdxOngb72J0IQt3UWiho0ALq/Y/Jia5KzAaHj1tRZA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=N3F5HVEJmdOE6S/Iwc7o/T1H5p7eu1e1diTD1gQsf24i0SEt0TRcjKhrMtSagm7wX1b1UUFcZ3b4Pjrt+vweCFqEQw96wO6vHCmyt4L4mS3LWhzFC4ONkhm8iofq41+0ZkinA6433LwE10TRPEG9l+03UNsl0bVawl34GWh+UzKiXl2Ya/91f9gUio1tT2trIHGro+jM8AEz0PeIhCOExjiSGeOj3Z/uMk70U2SINB1DrG5u/3ESGIzxwNigtRG2yyGD9MCfoEvUs7X3AFgF5O+vx6iszeScz9URCoAMw86GTiZIEzzyMcbY2q3FdDZt3ix8dg0LhrPHwHmbGLMd6w==
  • Cc: <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Tue, 21 Nov 2023 15:03:33 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 11/21/23 09:45, Roger Pau Monné wrote:
> On Wed, Sep 13, 2023 at 10:35:46AM -0400, Stewart Hildebrand wrote:
>> @@ -407,26 +439,25 @@ uint32_t vpci_read(pci_sbdf_t sbdf, unsigned int reg, 
>> unsigned int size)
>>  
>>  /*
>>   * Perform a maybe partial write to a register.
>> - *
>> - * Note that this will only work for simple registers, if Xen needs to
>> - * trap accesses to rw1c registers (like the status PCI header register)
>> - * the logic in vpci_write will have to be expanded in order to correctly
>> - * deal with them.
>>   */
>>  static void vpci_write_helper(const struct pci_dev *pdev,
>>                                const struct vpci_register *r, unsigned int 
>> size,
>>                                unsigned int offset, uint32_t data)
>>  {
>> +    uint32_t val = 0;
>> +
>>      ASSERT(size <= r->size);
>>  
>> -    if ( size != r->size )
>> +    if ( (size != r->size) || r->ro_mask )
>>      {
>> -        uint32_t val;
>> -
>>          val = r->read(pdev, r->offset, r->private);
>> +        val &= ~r->rw1c_mask;
>>          data = merge_result(val, data, size, offset);
>>      }
>>  
>> +    data &= ~(r->rsvdz_mask | r->ro_mask);
>> +    data |= val & r->ro_mask;
> 
> I've been thinking about this, and the way the ro_mask is implemented
> (and the way we want to handle ro bits) is the same behavior as RsvdP.
> I would suggest to rename the ro_mask to rsvdp_mask and note
> that for resilience reasons we will handle RO bits as RsvdP.

But the reads behave differently. RO should return the value, RsvdP should 
return 0 when read (according to the PCIe Base Spec 4.0).



 


Rackspace

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