2018-07-24 11:55:30

by Thomas Petazzoni

[permalink] [raw]
Subject: [PATCH 1/2] sparc: move MSI related definitions to where they are used

The definitions in arch/sparc/include/asm/msi.h are only used in
arch/sparc/mm/srmmu.c, so it makes sense to have them in the C file
directly.

In addition, having a custom arch/sparc/include/asm/msi.h prevents
from using the asm-generic version of this header, which is necessary
to be able to include <linux/msi.h> when CONFIG_GENERIC_MSI_IRQ_DOMAIN
is enabled.

Signed-off-by: Thomas Petazzoni <[email protected]>
---
arch/sparc/include/asm/msi.h | 32 --------------------------------
arch/sparc/mm/srmmu.c | 20 +++++++++++++++++++-
2 files changed, 19 insertions(+), 33 deletions(-)
delete mode 100644 arch/sparc/include/asm/msi.h

diff --git a/arch/sparc/include/asm/msi.h b/arch/sparc/include/asm/msi.h
deleted file mode 100644
index 3c17c1074431..000000000000
--- a/arch/sparc/include/asm/msi.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * msi.h: Defines specific to the MBus - Sbus - Interface.
- *
- * Copyright (C) 1996 David S. Miller ([email protected])
- * Copyright (C) 1996 Eddie C. Dost ([email protected])
- */
-
-#ifndef _SPARC_MSI_H
-#define _SPARC_MSI_H
-
-/*
- * Locations of MSI Registers.
- */
-#define MSI_MBUS_ARBEN 0xe0001008 /* MBus Arbiter Enable register */
-
-/*
- * Useful bits in the MSI Registers.
- */
-#define MSI_ASYNC_MODE 0x80000000 /* Operate the MSI asynchronously */
-
-
-static inline void msi_set_sync(void)
-{
- __asm__ __volatile__ ("lda [%0] %1, %%g3\n\t"
- "andn %%g3, %2, %%g3\n\t"
- "sta %%g3, [%0] %1\n\t" : :
- "r" (MSI_MBUS_ARBEN),
- "i" (ASI_M_CTL), "r" (MSI_ASYNC_MODE) : "g3");
-}
-
-#endif /* !(_SPARC_MSI_H) */
diff --git a/arch/sparc/mm/srmmu.c b/arch/sparc/mm/srmmu.c
index 1d70c3f6d986..be9cb0065179 100644
--- a/arch/sparc/mm/srmmu.c
+++ b/arch/sparc/mm/srmmu.c
@@ -37,7 +37,6 @@
#include <asm/mbus.h>
#include <asm/page.h>
#include <asm/asi.h>
-#include <asm/msi.h>
#include <asm/smp.h>
#include <asm/io.h>

@@ -116,6 +115,25 @@ static inline void srmmu_ctxd_set(ctxd_t *ctxp, pgd_t *pgdp)
set_pte((pte_t *)ctxp, pte);
}

+/*
+ * Locations of MSI Registers.
+ */
+#define MSI_MBUS_ARBEN 0xe0001008 /* MBus Arbiter Enable register */
+
+/*
+ * Useful bits in the MSI Registers.
+ */
+#define MSI_ASYNC_MODE 0x80000000 /* Operate the MSI asynchronously */
+
+static void msi_set_sync(void)
+{
+ __asm__ __volatile__ ("lda [%0] %1, %%g3\n\t"
+ "andn %%g3, %2, %%g3\n\t"
+ "sta %%g3, [%0] %1\n\t" : :
+ "r" (MSI_MBUS_ARBEN),
+ "i" (ASI_M_CTL), "r" (MSI_ASYNC_MODE) : "g3");
+}
+
void pmd_set(pmd_t *pmdp, pte_t *ptep)
{
unsigned long ptp; /* Physical address, shifted right by 4 */
--
2.14.4



2018-07-24 11:54:31

by Thomas Petazzoni

[permalink] [raw]
Subject: [PATCH 2/2] sparc: use asm-generic version of msi.h

This is necessary to be able to include <linux/msi.h> when
CONFIG_GENERIC_MSI_IRQ_DOMAIN is enabled. Without this, a build with
CONFIG_GENERIC_MSI_IRQ_DOMAIN fails with:

In file included from drivers//ata/ahci.c:45:0:
>> include/linux/msi.h:226:10: error: unknown type name 'msi_alloc_info_t'; did you mean 'sg_alloc_fn'?
msi_alloc_info_t *arg);
^~~~~~~~~~~~~~~~
sg_alloc_fn
include/linux/msi.h:230:9: error: unknown type name 'msi_alloc_info_t'; did you mean 'sg_alloc_fn'?
msi_alloc_info_t *arg);
^~~~~~~~~~~~~~~~
sg_alloc_fn
include/linux/msi.h:239:12: error: unknown type name 'msi_alloc_info_t'; did you mean 'sg_alloc_fn'?
msi_alloc_info_t *arg);
^~~~~~~~~~~~~~~~
sg_alloc_fn
include/linux/msi.h:240:22: error: unknown type name 'msi_alloc_info_t'; did you mean 'sg_alloc_fn'?
void (*msi_finish)(msi_alloc_info_t *arg, int retval);
^~~~~~~~~~~~~~~~
sg_alloc_fn
include/linux/msi.h:241:20: error: unknown type name 'msi_alloc_info_t'; did you mean 'sg_alloc_fn'?
void (*set_desc)(msi_alloc_info_t *arg,
^~~~~~~~~~~~~~~~
sg_alloc_fn
include/linux/msi.h:316:18: error: unknown type name 'msi_alloc_info_t'; did you mean 'sg_alloc_fn'?
int nvec, msi_alloc_info_t *args);
^~~~~~~~~~~~~~~~
sg_alloc_fn
include/linux/msi.h:318:29: error: unknown type name 'msi_alloc_info_t'; did you mean 'sg_alloc_fn'?
int virq, int nvec, msi_alloc_info_t *args);
^~~~~~~~~~~~~~~~
sg_alloc_fn

Signed-off-by: Thomas Petazzoni <[email protected]>
---
arch/sparc/include/asm/Kbuild | 1 +
1 file changed, 1 insertion(+)

diff --git a/arch/sparc/include/asm/Kbuild b/arch/sparc/include/asm/Kbuild
index ac67828da201..410b263ef5c8 100644
--- a/arch/sparc/include/asm/Kbuild
+++ b/arch/sparc/include/asm/Kbuild
@@ -13,6 +13,7 @@ generic-y += local64.h
generic-y += mcs_spinlock.h
generic-y += mm-arch-hooks.h
generic-y += module.h
+generic-y += msi.h
generic-y += preempt.h
generic-y += rwsem.h
generic-y += serial.h
--
2.14.4


2018-07-24 14:39:21

by Sam Ravnborg

[permalink] [raw]
Subject: Re: [PATCH 1/2] sparc: move MSI related definitions to where they are used

Hi Thomas.

One nitpick below.
But other than that this is a nice cleanup:
Acked-by: Sam Ravnborg <[email protected]>
> +/*
> + * Locations of MSI Registers.
> + */

The SPARC way to format comments follows netdev style.
So put it all in one line and everyone are happy:

/* Locations of MSI Registers. */

> +#define MSI_MBUS_ARBEN 0xe0001008 /* MBus Arbiter Enable register */
> +
> +/*
> + * Useful bits in the MSI Registers.
> + */
Likewise

Sam

2018-07-24 14:46:18

by Thomas Petazzoni

[permalink] [raw]
Subject: Re: [PATCH 1/2] sparc: move MSI related definitions to where they are used

Hello,

Thanks for the review.

On Tue, 24 Jul 2018 16:37:36 +0200, Sam Ravnborg wrote:

> One nitpick below.
> But other than that this is a nice cleanup:
> Acked-by: Sam Ravnborg <[email protected]>
> > +/*
> > + * Locations of MSI Registers.
> > + */
>
> The SPARC way to format comments follows netdev style.
> So put it all in one line and everyone are happy:

Well, the code is being moved from arch/sparc to arch/sparc, so
apparently, it was already non-compliant to this specific coding style
rule. Should the comments be made compliant as part of the same commit,
or a separate one ?

Thomas
--
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com

2018-07-24 14:57:14

by Sam Ravnborg

[permalink] [raw]
Subject: Re: [PATCH 1/2] sparc: move MSI related definitions to where they are used

Hi Thomas.

> >
> > The SPARC way to format comments follows netdev style.
> > So put it all in one line and everyone are happy:
>
> Well, the code is being moved from arch/sparc to arch/sparc, so
> apparently, it was already non-compliant to this specific coding style
> rule. Should the comments be made compliant as part of the same commit,
> or a separate one ?
Same commit, no reason to slit this in two.
So post a v2, then everyone should be happy.

I also looked at the second patch which looked obviously correct.
Feel free to add my Ack on both.

Sam

2018-07-30 20:02:16

by David Miller

[permalink] [raw]
Subject: Re: [PATCH 1/2] sparc: move MSI related definitions to where they are used

From: Thomas Petazzoni <[email protected]>
Date: Tue, 24 Jul 2018 13:53:04 +0200

> The definitions in arch/sparc/include/asm/msi.h are only used in
> arch/sparc/mm/srmmu.c, so it makes sense to have them in the C file
> directly.
>
> In addition, having a custom arch/sparc/include/asm/msi.h prevents
> from using the asm-generic version of this header, which is necessary
> to be able to include <linux/msi.h> when CONFIG_GENERIC_MSI_IRQ_DOMAIN
> is enabled.
>
> Signed-off-by: Thomas Petazzoni <[email protected]>

Applied.

2018-07-30 20:02:24

by David Miller

[permalink] [raw]
Subject: Re: [PATCH 2/2] sparc: use asm-generic version of msi.h

From: Thomas Petazzoni <[email protected]>
Date: Tue, 24 Jul 2018 13:53:05 +0200

> This is necessary to be able to include <linux/msi.h> when
> CONFIG_GENERIC_MSI_IRQ_DOMAIN is enabled. Without this, a build with
> CONFIG_GENERIC_MSI_IRQ_DOMAIN fails with:
...
> Signed-off-by: Thomas Petazzoni <[email protected]>

Applied.