linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [QUERY] Is there a reason pci_quirk_enable_intel_rp_mpc_acs() uses pci_write_config_word()
@ 2025-10-14  5:27 ALOK TIWARI
  2025-10-14 19:56 ` Alex Williamson
  0 siblings, 1 reply; 2+ messages in thread
From: ALOK TIWARI @ 2025-10-14  5:27 UTC (permalink / raw)
  To: Alex Williamson, Bjorn Helgaas, donald.d.dugger, linux-pci

Hi,

function pci_quirk_enable_intel_rp_mpc_acs() in
drivers/pci/quirks.c, I noticed that the code reads a 32-bit value from
INTEL_MPC_REG using pci_read_config_dword(), but writes it back using
pci_write_config_word().

The relevant lines are:

     pci_read_config_dword(dev, INTEL_MPC_REG, &mpc);
     if (!(mpc & INTEL_MPC_REG_IRBNCE)) {
         pci_info(dev, "Enabling MPC IRBNCE\n");
         mpc |= INTEL_MPC_REG_IRBNCE;
         pci_write_config_word(dev, INTEL_MPC_REG, mpc);
     }

Given that:
/* Miscellaneous Port Configuration register */
#define INTEL_MPC_REG 0xd8
/* MPC: Invalid Receive Bus Number Check Enable */
#define INTEL_MPC_REG_IRBNCE (1 << 26)

the IRBNCE bit is in the upper 16 bits of this 32-bit register.
It seems that using pci_write_config_word() would not actually update 
that bit.

is there a specific hardware reason for using a 16-bit write?

Thanks,
Alok

---
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 214ed060ca1b..1bd6e70058b5 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -5312,7 +5312,7 @@ static void 
pci_quirk_enable_intel_rp_mpc_acs(struct pci_dev *dev)
         if (!(mpc & INTEL_MPC_REG_IRBNCE)) {
                 pci_info(dev, "Enabling MPC IRBNCE\n");
                 mpc |= INTEL_MPC_REG_IRBNCE;
-               pci_write_config_word(dev, INTEL_MPC_REG, mpc);
+               pci_write_config_dword(dev, INTEL_MPC_REG, mpc);
         }
  }

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [QUERY] Is there a reason pci_quirk_enable_intel_rp_mpc_acs() uses pci_write_config_word()
  2025-10-14  5:27 [QUERY] Is there a reason pci_quirk_enable_intel_rp_mpc_acs() uses pci_write_config_word() ALOK TIWARI
@ 2025-10-14 19:56 ` Alex Williamson
  0 siblings, 0 replies; 2+ messages in thread
From: Alex Williamson @ 2025-10-14 19:56 UTC (permalink / raw)
  To: ALOK TIWARI; +Cc: Bjorn Helgaas, donald.d.dugger, linux-pci

On Tue, 14 Oct 2025 10:57:39 +0530
ALOK TIWARI <alok.a.tiwari@oracle.com> wrote:

> Hi,
> 
> function pci_quirk_enable_intel_rp_mpc_acs() in
> drivers/pci/quirks.c, I noticed that the code reads a 32-bit value from
> INTEL_MPC_REG using pci_read_config_dword(), but writes it back using
> pci_write_config_word().
> 
> The relevant lines are:
> 
>      pci_read_config_dword(dev, INTEL_MPC_REG, &mpc);
>      if (!(mpc & INTEL_MPC_REG_IRBNCE)) {
>          pci_info(dev, "Enabling MPC IRBNCE\n");
>          mpc |= INTEL_MPC_REG_IRBNCE;
>          pci_write_config_word(dev, INTEL_MPC_REG, mpc);
>      }
> 
> Given that:
> /* Miscellaneous Port Configuration register */
> #define INTEL_MPC_REG 0xd8
> /* MPC: Invalid Receive Bus Number Check Enable */
> #define INTEL_MPC_REG_IRBNCE (1 << 26)
> 
> the IRBNCE bit is in the upper 16 bits of this 32-bit register.
> It seems that using pci_write_config_word() would not actually update 
> that bit.
> 
> is there a specific hardware reason for using a 16-bit write?

It looks like a typo to me.  Please post a formal fix.  Thanks,

Alex

> ---
> diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
> index 214ed060ca1b..1bd6e70058b5 100644
> --- a/drivers/pci/quirks.c
> +++ b/drivers/pci/quirks.c
> @@ -5312,7 +5312,7 @@ static void 
> pci_quirk_enable_intel_rp_mpc_acs(struct pci_dev *dev)
>          if (!(mpc & INTEL_MPC_REG_IRBNCE)) {
>                  pci_info(dev, "Enabling MPC IRBNCE\n");
>                  mpc |= INTEL_MPC_REG_IRBNCE;
> -               pci_write_config_word(dev, INTEL_MPC_REG, mpc);
> +               pci_write_config_dword(dev, INTEL_MPC_REG, mpc);
>          }
>   }
> 


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-10-14 19:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-14  5:27 [QUERY] Is there a reason pci_quirk_enable_intel_rp_mpc_acs() uses pci_write_config_word() ALOK TIWARI
2025-10-14 19:56 ` Alex Williamson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).