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

Re: [PATCH v1 08/14] xen:arm: Implement pci access functions


  • To: Stefano Stabellini <sstabellini@xxxxxxxxxx>
  • From: Rahul Singh <Rahul.Singh@xxxxxxx>
  • Date: Tue, 14 Sep 2021 16:05:28 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.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; bh=4RDD4gxU08S1uSaApCZk1px4OvUrzzI9gUt7p+1J4WA=; b=AokXm3PhhP2M62dx4eUria7rzD8iP0e2DVDqb9oPf+YY6xCnhAoLBvEILjy6ojiUm2WgGj3QvPQlzqghEKriHoSMbKvem0XFrHmROuCWOaNRjUsq9Vg/hgO0A/SEjO8rUSbQFhk0Vh9KXeBJprNuFd6Yk7WgtH0b2sDWlnhtzp3nN5LcbmHwwNqoMYuaRSxqhqjQpqWC6LpwZ0DUT0Y8FH6mjXdrvFazSYXXSk4a52xetWtOia9LiY/xEQMylWj57jGXRE1iP0dKC8DRFlecf45v8hTTEEjiUarh7QYAtG1LxL2XX2kcSBlhf1W+prgVr1qP+AuuIWp20dr5jUsxrg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UOqH3mtdphovGdjuFvLw+wjIWRe7r6pepUAcaHJohJJQfqpEY1zFXnfTPLvsCBfvU1S4E4eUffFEVdsVT3KSN5o8JIxL4VuWjHt1zsxIcM6a8+dte0dAFdM9sf4O6TbKRUy1GfAx17OlwJ9BxVjnLvbT9ZhkMxbP/P3JCeZBE8FXHXpL0KTBahURLQWI4DtQQ7Af34CYG0sli3khDjeSmVHNzfFxNiTy+rxigtsE1VFrdZ2CVIyPxiBKLg9OArpRCE5UX1/dZ+BRrc4h0i6M4FnNxxyn3BbAzH9JbM6oHw9y8DsnuSqvl625IECYu1ON7mvrY7k43u8uz4SxtPaPGA==
  • Authentication-results-original: kernel.org; dkim=none (message not signed) header.d=none;kernel.org; dmarc=none action=none header.from=arm.com;
  • Cc: xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Bertrand Marquis <Bertrand.Marquis@xxxxxxx>, Julien Grall <julien@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Tue, 14 Sep 2021 16:06:00 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Original-authentication-results: kernel.org; dkim=none (message not signed) header.d=none;kernel.org; dmarc=none action=none header.from=arm.com;
  • Thread-index: AQHXlPLKFxZ9ODgqA0ysGgNkOt1JX6ucfp8AgAdcI4A=
  • Thread-topic: [PATCH v1 08/14] xen:arm: Implement pci access functions

Hi Stefano,

> On 10 Sep 2021, at 12:41 am, Stefano Stabellini <sstabellini@xxxxxxxxxx> 
> wrote:
> 
> On Thu, 19 Aug 2021, Rahul Singh wrote:
>> Implement generic pci access functions to read/write the configuration
>> space.
>> 
>> Signed-off-by: Rahul Singh <rahul.singh@xxxxxxx>
>> ---
>> xen/arch/arm/pci/pci-access.c      | 31 +++++++++++++++++++++++++++++-
>> xen/arch/arm/pci/pci-host-common.c | 19 ++++++++++++++++++
>> xen/include/asm-arm/pci.h          |  2 ++
>> 3 files changed, 51 insertions(+), 1 deletion(-)
>> 
>> diff --git a/xen/arch/arm/pci/pci-access.c b/xen/arch/arm/pci/pci-access.c
>> index f39f6a3a38..b94de3c3ac 100644
>> --- a/xen/arch/arm/pci/pci-access.c
>> +++ b/xen/arch/arm/pci/pci-access.c
>> @@ -72,12 +72,41 @@ int pci_generic_config_write(struct pci_host_bridge 
>> *bridge, uint32_t sbdf,
>> static uint32_t pci_config_read(pci_sbdf_t sbdf, unsigned int reg,
>>                                 unsigned int len)
>> {
>> -    return ~0U;
>> +    uint32_t val = GENMASK(0, len * 8);
> 
> This seems to be another default error value that it would be better to
> define with its own macro

This default error is used once do you want to me define as macro.  

> 
> 
>> +    struct pci_host_bridge *bridge = pci_find_host_bridge(sbdf.seg, 
>> sbdf.bus);
>> +
>> +    if ( unlikely(!bridge) )
>> +    {
>> +        printk(XENLOG_ERR "Unable to find bridge for "PRI_pci"\n",
>> +                sbdf.seg, sbdf.bus, sbdf.dev, sbdf.fn);
> 
> You are not actually printing sbdf.seg, sbdf.bus, sbdf.dev, sbdf.fn ?

Yes I am printing with “PRI_pci".
> 
> 
>> +        return val;
>> +    }
>> +
>> +    if ( unlikely(!bridge->ops->read) )
>> +        return val;
>> +
>> +    bridge->ops->read(bridge, (uint32_t) sbdf.sbdf, reg, len, &val);
> 
> Would it make sense to make the interface take a pci_sbdf_t directly
> instead of casting to uint32_t and back?

pci_sbdf_t is defined in "xen/pci.h” and "xen/pci.h” includes "asm-arm/pci.h”. 
If I modify the function argument in "asm-arm/pci.h” to use pci_sbdf_t  I will 
get compilation error.

> 
> 
>> +    return val;
>> }
>> 
>> static void pci_config_write(pci_sbdf_t sbdf, unsigned int reg,
>>                              unsigned int len, uint32_t val)
>> {
>> +    struct pci_host_bridge *bridge = pci_find_host_bridge(sbdf.seg, 
>> sbdf.bus);
>> +
>> +    if ( unlikely(!bridge) )
>> +    {
>> +        printk(XENLOG_ERR "Unable to find bridge for "PRI_pci"\n",
>> +                sbdf.seg, sbdf.bus, sbdf.dev, sbdf.fn);
> 
> same here
Yes I am printing with “PRI_pci".
>  

Regards
Rahul


 


Rackspace

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