[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0f861de2000013ba89f2adc2f1237e1b4abe248b.camel@infradead.org>
Date: Mon, 05 May 2025 20:19:09 -0700
From: David Woodhouse <dwmw2@...radead.org>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc: Ashish Kalra <ashish.kalra@....com>, "Kirill A. Shutemov"
<kirill.shutemov@...ux.intel.com>, linux-kernel@...r.kernel.org, Thomas
Gleixner <tglx@...utronix.de>, Ingo Molnar <mingo@...hat.com>, Borislav
Petkov <bp@...en8.de>, Dave Hansen <dave.hansen@...ux.intel.com>,
x86@...nel.org, "H. Peter Anvin" <hpa@...or.com>, Denis Mukhin
<dmukhin@...d.com>
Subject: Re: [PATCH v1 0/6] x86/boot: Enable earlyprintk on MMIO (8-bit)
On Mon, 2025-05-05 at 16:32 -0700, David Woodhouse wrote:
>
> Thanks. Should I be expecting this to work...?
>
> qemu-system-x86_64 -display none -vga none -accel kvm,kernel-irqchip=split \
> -kernel arch/x86/boot/bzImage \
> -append "console=ttyS4 root=/dev/vda1 earlyprintk=pciserial" \
> -chardev stdio,mux=on,id=char0,signal=off -mon char0 -device pci-serial,chardev=char0
Hm, no, qemu's pci-serial is PIO. I'd need to do this:
--- a/hw/char/serial-pci.c
+++ b/hw/char/serial-pci.c
@@ -58,7 +58,7 @@ static void serial_pci_realize(PCIDevice *dev, Error **errp)
s->irq = pci_allocate_irq(&pci->dev);
memory_region_init_io(&s->io, OBJECT(pci), &serial_io_ops, s, "serial", 8);
- pci_register_bar(&pci->dev, 0, PCI_BASE_ADDRESS_SPACE_IO, &s->io);
+ pci_register_bar(&pci->dev, 0, PCI_BASE_ADDRESS_SPACE_MEMORY, &s->io);
}
static void serial_pci_exit(PCIDevice *dev)
And then the kernel's 'earlyprintk=pciserial' needs to be told the BDF,
e.g. earlyprintk=pciserial,00:03.0,keep
And it's still defaulting to mmio32 unless I do this in the kernel...
--- a/arch/x86/kernel/early_printk.c
+++ b/arch/x86/kernel/early_printk.c
@@ -198,7 +198,7 @@ static __init void early_serial_init(char *s)
static __noendbr void mem32_serial_out(unsigned long addr, int offset, int value)
{
- u32 __iomem *vaddr = (u32 __iomem *)addr;
+ u8 __iomem *vaddr = (u8 __iomem *)addr;
/* shift implied by pointer type */
writel(value, vaddr + offset);
}
@@ -206,7 +206,7 @@ ANNOTATE_NOENDBR_SYM(mem32_serial_out);
static __noendbr unsigned int mem32_serial_in(unsigned long addr, int offset)
{
- u32 __iomem *vaddr = (u32 __iomem *)addr;
+ u8 __iomem *vaddr = (u8 __iomem *)addr;
/* shift implied by pointer type */
return readl(vaddr + offset);
}
If you can get this part working sanely, I'll happily add the kexec debug part.
Download attachment "smime.p7s" of type "application/pkcs7-signature" (5069 bytes)
Powered by blists - more mailing lists