Skip to content
  • Philippe Mathieu-Daudé's avatar
    711ef337
    hw/pci-host/bonito: Allow PCI config accesses smaller than 32-bit · 711ef337
    Philippe Mathieu-Daudé authored
    When running the official PMON firmware for the Fuloong 2E, we see
    8-bit and 16-bit accesses to PCI config space:
    
      $ qemu-system-mips64el -M fuloong2e -bios pmon_2e.bin \
        -trace -trace bonito\* -trace pci_cfg\*
    
      pci_cfg_write vt82c686b-pm 05:4 @0x90 <- 0xeee1
      bonito_spciconf_small_access PCI config address is smaller then 32-bit, addr: 0x4d2, size: 2
      pci_cfg_write vt82c686b-pm 05:4 @0xd2 <- 0x1
      pci_cfg_write vt82c686b-pm 05:4 @0x4 <- 0x1
      pci_cfg_write vt82c686b-isa 05:0 @0x4 <- 0x7
      bonito_spciconf_small_access PCI config address is smaller then 32-bit, addr: 0x81, size: 1
      pci_cfg_read vt82c686b-isa 05:0 @0x81 -> 0x0
      bonito_spciconf_small_access PCI config address is smaller then 32-bit, addr: 0x81, size: 1
      pci_cfg_write vt82c686b-isa 05:0 @0x81 <- 0x80
      bonito_spciconf_small_access PCI config address is smaller then 32-bit, addr: 0x83, size: 1
      pci_cfg_write vt82c686b-isa 05:0 @0x83 <- 0x89
      bonito_spciconf_small_access PCI config address is smaller then 32-bit, addr: 0x85, size: 1
      pci_cfg_write vt82c686b-isa 05:0 @0x85 <- 0x3
      bonito_spciconf_small_access PCI config address is smaller then 32-bit, addr: 0x5a, size: 1
      pci_cfg_write vt82c686b-isa 05:0 @0x5a <- 0x7
      bonito_spciconf_small_access PCI config address is smaller then 32-bit, addr: 0x85, size: 1
      pci_cfg_write vt82c686b-isa 05:0 @0x85 <- 0x1
    
    Also this is what the Linux kernel does since it supports the Bonito
    north bridge:
    https://elixir.bootlin.com/linux/v2.6.15/source/arch/mips/pci/ops-bonito64.c#L85
    
    
    
    So it seems safe to assume the datasheet is incomplete or outdated
    regarding the address constraints.
    
    This problem was exposed by commit 911629e6
    ("vt82c686: Fix SMBus IO base and configuration registers").
    
    Reported-by: default avatarBALATON Zoltan <balaton@eik.bme.hu>
    Suggested-by: default avatarJiaxun Yang <jiaxun.yang@flygoat.com>
    Signed-off-by: default avatarPhilippe Mathieu-Daudé <f4bug@amsat.org>
    Message-Id: <20210624202747.1433023-4-f4bug@amsat.org>
    Tested-by: default avatarBALATON Zoltan <balaton@eik.bme.hu>
    711ef337
    hw/pci-host/bonito: Allow PCI config accesses smaller than 32-bit
    Philippe Mathieu-Daudé authored
    When running the official PMON firmware for the Fuloong 2E, we see
    8-bit and 16-bit accesses to PCI config space:
    
      $ qemu-system-mips64el -M fuloong2e -bios pmon_2e.bin \
        -trace -trace bonito\* -trace pci_cfg\*
    
      pci_cfg_write vt82c686b-pm 05:4 @0x90 <- 0xeee1
      bonito_spciconf_small_access PCI config address is smaller then 32-bit, addr: 0x4d2, size: 2
      pci_cfg_write vt82c686b-pm 05:4 @0xd2 <- 0x1
      pci_cfg_write vt82c686b-pm 05:4 @0x4 <- 0x1
      pci_cfg_write vt82c686b-isa 05:0 @0x4 <- 0x7
      bonito_spciconf_small_access PCI config address is smaller then 32-bit, addr: 0x81, size: 1
      pci_cfg_read vt82c686b-isa 05:0 @0x81 -> 0x0
      bonito_spciconf_small_access PCI config address is smaller then 32-bit, addr: 0x81, size: 1
      pci_cfg_write vt82c686b-isa 05:0 @0x81 <- 0x80
      bonito_spciconf_small_access PCI config address is smaller then 32-bit, addr: 0x83, size: 1
      pci_cfg_write vt82c686b-isa 05:0 @0x83 <- 0x89
      bonito_spciconf_small_access PCI config address is smaller then 32-bit, addr: 0x85, size: 1
      pci_cfg_write vt82c686b-isa 05:0 @0x85 <- 0x3
      bonito_spciconf_small_access PCI config address is smaller then 32-bit, addr: 0x5a, size: 1
      pci_cfg_write vt82c686b-isa 05:0 @0x5a <- 0x7
      bonito_spciconf_small_access PCI config address is smaller then 32-bit, addr: 0x85, size: 1
      pci_cfg_write vt82c686b-isa 05:0 @0x85 <- 0x1
    
    Also this is what the Linux kernel does since it supports the Bonito
    north bridge:
    https://elixir.bootlin.com/linux/v2.6.15/source/arch/mips/pci/ops-bonito64.c#L85
    
    
    
    So it seems safe to assume the datasheet is incomplete or outdated
    regarding the address constraints.
    
    This problem was exposed by commit 911629e6
    ("vt82c686: Fix SMBus IO base and configuration registers").
    
    Reported-by: default avatarBALATON Zoltan <balaton@eik.bme.hu>
    Suggested-by: default avatarJiaxun Yang <jiaxun.yang@flygoat.com>
    Signed-off-by: default avatarPhilippe Mathieu-Daudé <f4bug@amsat.org>
    Message-Id: <20210624202747.1433023-4-f4bug@amsat.org>
    Tested-by: default avatarBALATON Zoltan <balaton@eik.bme.hu>
Loading