From: BALATON Zoltan <balaton@eik.bme.hu>
To: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
Cc: Aleksandar Rikalo <aleksandar.rikalo@syrmia.com>,
Huacai Chen <chenhuacai@kernel.org>,
qemu-devel@nongnu.org,
Wainer dos Santos Moschetta <wainersm@redhat.com>,
Cleber Rosa <crosa@redhat.com>,
Aurelien Jarno <aurelien@aurel32.net>
Subject: Re: [PATCH 3/5] hw/pci-host/bonito: Allow PCI config accesses smaller than 32-bit
Date: Thu, 24 Jun 2021 22:49:02 +0200 (CEST) [thread overview]
Message-ID: <10a58f2c-7b8f-fe6c-53c6-cd70b378395a@eik.bme.hu> (raw)
In-Reply-To: <20210624202747.1433023-4-f4bug@amsat.org>
[-- Attachment #1: Type: text/plain, Size: 3689 bytes --]
On Thu, 24 Jun 2021, Philippe Mathieu-Daudé wrote:
> 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 911629e6d3773a8adeab48b
> ("vt82c686: Fix SMBus IO base and configuration registers").
>
> Reported-by: BALATON Zoltan <balaton@eik.bme.hu>
> Suggested-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
> hw/pci-host/bonito.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/hw/pci-host/bonito.c b/hw/pci-host/bonito.c
> index 751fdcec689..3c10608c9a2 100644
> --- a/hw/pci-host/bonito.c
> +++ b/hw/pci-host/bonito.c
> @@ -187,7 +187,7 @@ FIELD(BONGENCFG, PCIQUEUE, 12, 1)
> #define BONITO_PCICONF_FUN_MASK 0x700 /* [10:8] */
> #define BONITO_PCICONF_FUN_OFFSET 8
> #define BONITO_PCICONF_REG_MASK_DS (~3) /* Per datasheet */
> -#define BONITO_PCICONF_REG_MASK 0xFC
> +#define BONITO_PCICONF_REG_MASK_HW 0xff /* As seen on hardware */
I think we didn't really see it on hardware just inferred this from what
the firmware does. That's a slight difference but may worth noting so
people later don't think this was really tested with real hardware. Maybe
"As seen with PMON"? Also if this is a loongson thing as was thought in
the thread in December then maybe the #define could be named that instead
of _HW so if somebody wants to reuse this model later ad Bonito then know
that it implements the Loongson version.
Regards,
BALATON Zoltan
> #define BONITO_PCICONF_REG_OFFSET 0
>
>
> @@ -466,7 +466,7 @@ static uint32_t bonito_sbridge_pciaddr(void *opaque, hwaddr addr)
> BONITO_PCICONF_IDSEL_OFFSET;
> devno = ctz32(idsel);
> funno = (cfgaddr & BONITO_PCICONF_FUN_MASK) >> BONITO_PCICONF_FUN_OFFSET;
> - regno = (cfgaddr & BONITO_PCICONF_REG_MASK) >> BONITO_PCICONF_REG_OFFSET;
> + regno = (cfgaddr & BONITO_PCICONF_REG_MASK_HW) >> BONITO_PCICONF_REG_OFFSET;
>
> if (idsel == 0) {
> error_report("error in bonito pci config address 0x" TARGET_FMT_plx
>
next prev parent reply other threads:[~2021-06-24 20:50 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-24 20:27 [PATCH 0/5] hw/mips: Fix the Fuloong 2E machine with PMON bios Philippe Mathieu-Daudé
2021-06-24 20:27 ` [PATCH 1/5] hw/isa/vt82c686: Replace magic numbers by definitions Philippe Mathieu-Daudé
2021-06-24 21:02 ` BALATON Zoltan
2021-06-24 20:27 ` [PATCH 2/5] hw/pci-host/bonito: Trace PCI config accesses smaller than 32-bit Philippe Mathieu-Daudé
2021-06-24 20:27 ` [PATCH 3/5] hw/pci-host/bonito: Allow " Philippe Mathieu-Daudé
2021-06-24 20:49 ` BALATON Zoltan [this message]
2021-06-29 4:54 ` Philippe Mathieu-Daudé
2021-06-24 20:27 ` [PATCH 4/5] tests/acceptance: Test Linux on the Fuloong 2E machine Philippe Mathieu-Daudé
2021-06-28 19:21 ` Wainer dos Santos Moschetta
2021-06-24 20:27 ` [PATCH 5/5] tests/acceptance: Test PMON " Philippe Mathieu-Daudé
2021-06-24 20:43 ` BALATON Zoltan
2021-06-29 4:51 ` Philippe Mathieu-Daudé
2021-06-29 10:47 ` BALATON Zoltan
2021-06-29 11:30 ` Philippe Mathieu-Daudé
2021-06-29 12:08 ` BALATON Zoltan
2021-06-28 19:38 ` Wainer dos Santos Moschetta
2021-07-01 21:49 ` [PATCH 0/5] hw/mips: Fix the Fuloong 2E machine with PMON bios Philippe Mathieu-Daudé
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=10a58f2c-7b8f-fe6c-53c6-cd70b378395a@eik.bme.hu \
--to=balaton@eik.bme.hu \
--cc=aleksandar.rikalo@syrmia.com \
--cc=aurelien@aurel32.net \
--cc=chenhuacai@kernel.org \
--cc=crosa@redhat.com \
--cc=f4bug@amsat.org \
--cc=qemu-devel@nongnu.org \
--cc=wainersm@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.