Re: [PATCH v3] UML: pata_cs5536: fix build for X86_32 UML with TRACEPOINTS

From: Christoph Hellwig
Date: Sun Apr 16 2023 - 02:20:31 EST


On Fri, Apr 14, 2023 at 03:55:07PM +0200, Johannes Berg wrote:
> On Sun, 2023-04-09 at 18:13 -0700, Randy Dunlap wrote:
> > Current build of pata_cs5536 for i386 UML fails with:
> >
> > ERROR: modpost: "__tracepoint_write_msr" [drivers/ata/pata_cs5536.ko] undefined!
> > ERROR: modpost: "do_trace_write_msr" [drivers/ata/pata_cs5536.ko] undefined!
> > ERROR: modpost: "__tracepoint_read_msr" [drivers/ata/pata_cs5536.ko] undefined!
> > ERROR: modpost: "do_trace_read_msr" [drivers/ata/pata_cs5536.ko] undefined!
> >
> > Add the arch/x86/lib/msr.o binary to resolve these undefined symbols.
> >
>
> Hm. Does this make sense? I can't see it'd work on UML to configure an
> IDE device through MSRs? Surely that can't work? IOW, that entire driver
> can't really work anyway can it?
>
> OTOH, maybe theoretically it could work in PCI, just not with MSRs, and
> then this patch makes some sense?

I think it is is integrated into actual Geode SOCs. That being
said something like the patch below seems as simple as it gets and
at least gives build coverage on uml

diff --git a/drivers/ata/pata_cs5536.c b/drivers/ata/pata_cs5536.c
index ab47aeb5587f55..4f5d9afd51c9d8 100644
--- a/drivers/ata/pata_cs5536.c
+++ b/drivers/ata/pata_cs5536.c
@@ -27,7 +27,7 @@
#include <scsi/scsi_host.h>
#include <linux/dmi.h>

-#ifdef CONFIG_X86_32
+#if defined(CONFIG_X86_32) && !defined(CONFIG_UML)
#include <asm/msr.h>
static int use_msr;
module_param_named(msr, use_msr, int, 0644);