Re: [PATCH v7 05/16] module: make module_memory_{alloc,free} more self-contained

2024-04-30 Thread Philippe Mathieu-Daudé

On 29/4/24 14:16, Mike Rapoport wrote:

From: "Mike Rapoport (IBM)" 

Move the logic related to the memory allocation and freeing into
module_memory_alloc() and module_memory_free().

Signed-off-by: Mike Rapoport (IBM) 
---
  kernel/module/main.c | 64 +++-
  1 file changed, 39 insertions(+), 25 deletions(-)


Nice code simplification.

Reviewed-by: Philippe Mathieu-Daudé 



Re: [PATCH v5 11/15] arch: make execmem setup available regardless of CONFIG_MODULES

2024-04-22 Thread Philippe Mathieu-Daudé

On 22/4/24 11:44, Mike Rapoport wrote:

From: "Mike Rapoport (IBM)" 

execmem does not depend on modules, on the contrary modules use
execmem.

To make execmem available when CONFIG_MODULES=n, for instance for
kprobes, split execmem_params initialization out from
arch/*/kernel/module.c and compile it when CONFIG_EXECMEM=y

Signed-off-by: Mike Rapoport (IBM) 
---
  arch/arm/kernel/module.c   |  43 --
  arch/arm/mm/init.c |  45 +++
  arch/arm64/kernel/module.c | 140 -
  arch/arm64/mm/init.c   | 140 +
  arch/loongarch/kernel/module.c |  19 -
  arch/loongarch/mm/init.c   |  21 +
  arch/mips/kernel/module.c  |  22 --
  arch/mips/mm/init.c|  23 ++
  arch/nios2/kernel/module.c |  20 -
  arch/nios2/mm/init.c   |  21 +
  arch/parisc/kernel/module.c|  20 -
  arch/parisc/mm/init.c  |  23 +-
  arch/powerpc/kernel/module.c   |  63 ---
  arch/powerpc/mm/mem.c  |  64 +++
  arch/riscv/kernel/module.c |  44 ---
  arch/riscv/mm/init.c   |  45 +++
  arch/s390/kernel/module.c  |  27 ---
  arch/s390/mm/init.c|  30 +++
  arch/sparc/kernel/module.c |  19 -
  arch/sparc/mm/Makefile |   2 +
  arch/sparc/mm/execmem.c|  21 +
  arch/x86/kernel/module.c   |  27 ---
  arch/x86/mm/init.c |  29 +++
  23 files changed, 463 insertions(+), 445 deletions(-)
  create mode 100644 arch/sparc/mm/execmem.c


Reviewed-by: Philippe Mathieu-Daudé 



Re: [PATCH 2/4] KVM: remove unused argument of kvm_handle_hva_range()

2024-04-08 Thread Philippe Mathieu-Daudé

On 5/4/24 13:58, Paolo Bonzini wrote:

The only user was kvm_mmu_notifier_change_pte(), which is now gone.

Signed-off-by: Paolo Bonzini 
---
  virt/kvm/kvm_main.c | 7 +--
  1 file changed, 1 insertion(+), 6 deletions(-)


Reviewed-by: Philippe Mathieu-Daudé 



Re: [PATCH 4/4] mm: replace set_pte_at_notify() with just set_pte_at()

2024-04-08 Thread Philippe Mathieu-Daudé

On 5/4/24 13:58, Paolo Bonzini wrote:

With the demise of the .change_pte() MMU notifier callback, there is no
notification happening in set_pte_at_notify().  It is a synonym of
set_pte_at() and can be replaced with it.

Signed-off-by: Paolo Bonzini 
---
  include/linux/mmu_notifier.h | 2 --
  kernel/events/uprobes.c  | 5 ++---
  mm/ksm.c | 4 ++--
  mm/memory.c  | 7 +--
  mm/migrate_device.c  | 8 ++--
  5 files changed, 7 insertions(+), 19 deletions(-)


Reviewed-by: Philippe Mathieu-Daudé 



Re: [PATCH v4 3/5] arch/powerpc: Remove trailing whitespaces

2023-09-13 Thread Philippe Mathieu-Daudé

On 12/9/23 15:49, Thomas Zimmermann wrote:

Fix coding style. No functional changes.

Signed-off-by: Thomas Zimmermann 
---
  arch/powerpc/include/asm/machdep.h | 10 +-
  1 file changed, 5 insertions(+), 5 deletions(-)


Reviewed-by: Philippe Mathieu-Daudé 



Re: [PATCH v2 1/3] kconfig: add dependencies of POWER_RESET for mips malta

2023-09-04 Thread Philippe Mathieu-Daudé

On 4/9/23 19:40, Yuan Tan wrote:


On 9/4/2023 6:58 PM, Christophe Leroy wrote:


Le 04/09/2023 à 12:51, Philippe Mathieu-Daudé a écrit :

On 4/9/23 11:24, Yuan Tan wrote:

Hi,

On 9/4/2023 3:40 PM, Philippe Mathieu-Daudé wrote:

Hi,

On 1/9/23 04:42, Yuan Tan wrote:

MIPS Malta's power off depends on PCI, PCI_QUIRKS, and
POWER_RESET_PIIX4_POWEROFF to work. Enable them when POWER_RESET 
is set

for convenience.

Suggested-by: Zhangjin Wu 
Signed-off-by: Yuan Tan 
---
   arch/mips/Kconfig | 3 +++
   1 file changed, 3 insertions(+)

diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index bc8421859006..13bacbd05125 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -547,6 +547,9 @@ config MIPS_MALTA
   select MIPS_L1_CACHE_SHIFT_6
   select MIPS_MSC
   select PCI_GT64XXX_PCI0
+    select PCI if POWER_RESET
+    select PCI_QUIRKS if POWER_RESET
+    select POWER_RESET_PIIX4_POWEROFF if POWER_RESET
   select SMP_UP if SMP
   select SWAP_IO_SPACE
   select SYS_HAS_CPU_MIPS32_R1

Shouldn't we also update the _defconfig files?


Sorry, in my last email, I forgot to reply to all. So I am now
resending this email.

In malta_defconfig, PCI and POWER_RESET_PIIX4_POWEROFF have already
been set and PCI_QUIRKS is also selected by FSL_PCI [=n].

So shutdown and reboot with malta_defconfig is working and there is no
need to update the malta_defconfig 

Since the dependency is now enforced by Kconfig, the defconfig can
be simplified:

--- a/arch/mips/configs/malta_defconfig
+++ b/arch/mips/configs/malta_defconfig
@@ -306,3 +306,2 @@ CONFIG_SERIAL_8250_CONSOLE=y
   CONFIG_POWER_RESET=y
-CONFIG_POWER_RESET_PIIX4_POWEROFF=y
   CONFIG_POWER_RESET_SYSCON=y

But maybe we don't care, I don't know.

I understand from what you say that you update malta_defconfig manually ?

defconfigs shouldn't be updated manually.

Once you have the new .config you should use "make savedefconfig" then
replace your file by the newly generated defconfig file.

Christophe


To do so, I just unset CONFIG_POWER_RESET and set it again in 
menuconfig, then "make savedefconfig". The POWER_RESET part is simplified.


  CONFIG_POWER_RESET=y
-CONFIG_POWER_RESET_PIIX4_POWEROFF=y
-CONFIG_POWER_RESET_SYSCON=y

  However, I found that there's other changes in this new 
malta_defconfig, for example


CONFIG_NLS_KOI8_U=m CONFIG_CRYPTO_CRYPTD=m -CONFIG_CRYPTO_LRW=m 
-CONFIG_CRYPTO_PCBC=m -CONFIG_CRYPTO_HMAC=y -CONFIG_CRYPTO_XCBC=m 
-CONFIG_CRYPTO_MD4=m -CONFIG_CRYPTO_SHA512=m -CONFIG_CRYPTO_WP512=m 
-CONFIG_CRYPTO_ANUBIS=m CONFIG_CRYPTO_BLOWFISH=m CONFIG_CRYPTO_CAMELLIA=m


Should I import all these changes in a commit? Or only POWER_RESET part.


I'd first update the defconfigs with mainline (as a cleanup)
then apply your series on top, re-running 'make savedefconfig'
you should get only the changes relevant to your work.



Re: [PATCH v2 1/3] kconfig: add dependencies of POWER_RESET for mips malta

2023-09-04 Thread Philippe Mathieu-Daudé

On 4/9/23 11:24, Yuan Tan wrote:

Hi,

On 9/4/2023 3:40 PM, Philippe Mathieu-Daudé wrote:

Hi,

On 1/9/23 04:42, Yuan Tan wrote:

MIPS Malta's power off depends on PCI, PCI_QUIRKS, and
POWER_RESET_PIIX4_POWEROFF to work. Enable them when POWER_RESET is set
for convenience.

Suggested-by: Zhangjin Wu 
Signed-off-by: Yuan Tan 
---
  arch/mips/Kconfig | 3 +++
  1 file changed, 3 insertions(+)

diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index bc8421859006..13bacbd05125 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -547,6 +547,9 @@ config MIPS_MALTA
  select MIPS_L1_CACHE_SHIFT_6
  select MIPS_MSC
  select PCI_GT64XXX_PCI0
+    select PCI if POWER_RESET
+    select PCI_QUIRKS if POWER_RESET
+    select POWER_RESET_PIIX4_POWEROFF if POWER_RESET
  select SMP_UP if SMP
  select SWAP_IO_SPACE
  select SYS_HAS_CPU_MIPS32_R1


Shouldn't we also update the _defconfig files?

Sorry, in my last email, I forgot to reply to all. So I am now resending 
this email.


In malta_defconfig, PCI and POWER_RESET_PIIX4_POWEROFF have already been 
set and PCI_QUIRKS is also selected by FSL_PCI [=n].


So shutdown and reboot with malta_defconfig is working and there is no 
need to update the malta_defconfig 


Since the dependency is now enforced by Kconfig, the defconfig can
be simplified:

--- a/arch/mips/configs/malta_defconfig
+++ b/arch/mips/configs/malta_defconfig
@@ -306,3 +306,2 @@ CONFIG_SERIAL_8250_CONSOLE=y
 CONFIG_POWER_RESET=y
-CONFIG_POWER_RESET_PIIX4_POWEROFF=y
 CONFIG_POWER_RESET_SYSCON=y

But maybe we don't care, I don't know.


Re: [PATCH v2 1/3] kconfig: add dependencies of POWER_RESET for mips malta

2023-09-04 Thread Philippe Mathieu-Daudé

Hi,

On 1/9/23 04:42, Yuan Tan wrote:

MIPS Malta's power off depends on PCI, PCI_QUIRKS, and
POWER_RESET_PIIX4_POWEROFF to work. Enable them when POWER_RESET is set
for convenience.

Suggested-by: Zhangjin Wu 
Signed-off-by: Yuan Tan 
---
  arch/mips/Kconfig | 3 +++
  1 file changed, 3 insertions(+)

diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index bc8421859006..13bacbd05125 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -547,6 +547,9 @@ config MIPS_MALTA
select MIPS_L1_CACHE_SHIFT_6
select MIPS_MSC
select PCI_GT64XXX_PCI0
+   select PCI if POWER_RESET
+   select PCI_QUIRKS if POWER_RESET
+   select POWER_RESET_PIIX4_POWEROFF if POWER_RESET
select SMP_UP if SMP
select SWAP_IO_SPACE
select SYS_HAS_CPU_MIPS32_R1


Shouldn't we also update the _defconfig files?


Re: [PATCH v3 3/4] arch/mips/configs/*_defconfig cleanup

2023-08-17 Thread Philippe Mathieu-Daudé

On 17/8/23 13:50, Trevor Woerner wrote:

Drop CONFIG_IP_NF_TARGET_CLUSTERIP from any remaining mips defconfigs as it
was removed in commit 9db5d918e2c0 ("netfilter: ip_tables: remove clusterip
target").

Signed-off-by: Trevor Woerner 
---
  arch/mips/configs/ip22_defconfig| 1 -
  arch/mips/configs/malta_defconfig   | 1 -
  arch/mips/configs/malta_kvm_defconfig   | 1 -
  arch/mips/configs/maltaup_xpa_defconfig | 1 -
  arch/mips/configs/rm200_defconfig   | 1 -
  5 files changed, 5 deletions(-)


Reviewed-by: Philippe Mathieu-Daudé 



Re: [PATCH v2 3/4] arch/mips/configs/*_defconfig cleanup

2023-08-17 Thread Philippe Mathieu-Daudé

Hi Trevor,

On 17/8/23 04:59, Trevor Woerner wrote:

Drop CONFIG_IP_NF_TARGET_CLUSTERIP from any remaining mips defconfigs as it
was removed in commit 57f8e00d8a82 ("usb: 71 musb: Drop old unused am35x
glue layer").


How 57f8e00d8a82 is related? Do you mean commit 9db5d918e2c0
("netfilter: ip_tables: remove clusterip target")?


Signed-off-by: Trevor Woerner 
---
  arch/mips/configs/ip22_defconfig| 1 -
  arch/mips/configs/malta_defconfig   | 1 -
  arch/mips/configs/malta_kvm_defconfig   | 1 -
  arch/mips/configs/maltaup_xpa_defconfig | 1 -
  arch/mips/configs/rm200_defconfig   | 1 -
  5 files changed, 5 deletions(-)

diff --git a/arch/mips/configs/ip22_defconfig b/arch/mips/configs/ip22_defconfig
index 44821f497261..dc49b09d492b 100644
--- a/arch/mips/configs/ip22_defconfig
+++ b/arch/mips/configs/ip22_defconfig
@@ -127,7 +127,6 @@ CONFIG_IP_NF_MATCH_TTL=m
  CONFIG_IP_NF_FILTER=m
  CONFIG_IP_NF_TARGET_REJECT=m
  CONFIG_IP_NF_MANGLE=m
-CONFIG_IP_NF_TARGET_CLUSTERIP=m
  CONFIG_IP_NF_TARGET_ECN=m
  CONFIG_IP_NF_TARGET_TTL=m
  CONFIG_IP_NF_RAW=m




Re: [PATCH v2 5/9] vgacon: remove screen_info dependency

2023-07-19 Thread Philippe Mathieu-Daudé

Hi Arnd,

On 19/7/23 14:39, Arnd Bergmann wrote:

From: Arnd Bergmann 

The vga console driver is fairly self-contained, and only used by
architectures that explicitly initialize the screen_info settings.

Chance every instance that picks the vga console by setting conswitchp
to call a function instead, and pass a reference to the screen_info
there.

Signed-off-by: Arnd Bergmann 
---
  arch/alpha/kernel/setup.c  |  2 +-
  arch/arm/kernel/setup.c|  2 +-
  arch/ia64/kernel/setup.c   |  2 +-
  arch/mips/kernel/setup.c   |  2 +-
  arch/x86/kernel/setup.c|  2 +-
  drivers/firmware/pcdp.c|  2 +-
  drivers/video/console/vgacon.c | 68 --
  include/linux/console.h|  7 
  8 files changed, 53 insertions(+), 34 deletions(-)




@@ -1074,13 +1077,13 @@ static int vgacon_resize(struct vc_data *c, unsigned 
int width,
 * Ho ho!  Someone (svgatextmode, eh?) may have reprogrammed
 * the video mode!  Set the new defaults then and go away.
 */
-   screen_info.orig_video_cols = width;
-   screen_info.orig_video_lines = height;
+   vga_si->orig_video_cols = width;
+   vga_si->orig_video_lines = height;
vga_default_font_height = c->vc_cell_height;
return 0;
}
-   if (width % 2 || width > screen_info.orig_video_cols ||
-   height > (screen_info.orig_video_lines * vga_default_font_height)/
+   if (width % 2 || width > vga_si->orig_video_cols ||
+   height > (vga_si->orig_video_lines * vga_default_font_height)/
c->vc_cell_height)
return -EINVAL;
  
@@ -1110,8 +1113,8 @@ static void vgacon_save_screen(struct vc_data *c)

 * console initialization routines.
 */
vga_bootup_console = 1;
-   c->state.x = screen_info.orig_x;
-   c->state.y = screen_info.orig_y;
+   c->state.x = vga_si->orig_x;
+   c->state.y = vga_si->orig_y;


Not really my area, so bare with me if this is obviously not
possible :) If using DUMMY_CONSOLE, can we trigger a save_screen
/ resize? If so, we'd reach here with vga_si=NULL.


}
  
  	/* We can't copy in more than the size of the video buffer,

@@ -1204,4 +1207,13 @@ const struct consw vga_con = {
  };
  EXPORT_SYMBOL(vga_con);
  
+void vgacon_register_screen(struct screen_info *si)

+{
+   if (!si || vga_si)
+   return;
+
+   conswitchp = _con;
+   vga_si = si;
+}




Re: [PATCH v2 4/9] vgacon, arch/*: remove unused screen_info definitions

2023-07-19 Thread Philippe Mathieu-Daudé

On 19/7/23 14:39, Arnd Bergmann wrote:

From: Arnd Bergmann 

A number of architectures either kept the screen_info definition for
historical purposes as it used to be required by the generic VT code, or
they copied it from another architecture in order to build the VGA console
driver in an allmodconfig build. The mips definition is used by some
platforms, but the initialization on jazz is not needed.

Now that vgacon no longer builds on these architectures, remove the
stale definitions and initializations.

Reviewed-by: Javier Martinez Canillas 
Reviewed-by: Thomas Zimmermann 
Acked-by: Dinh Nguyen 
Acked-by: Max Filippov 
Acked-by: Palmer Dabbelt 
Acked-by: Guo Ren 
Signed-off-by: Arnd Bergmann 
---
  arch/csky/kernel/setup.c  | 12 
  arch/hexagon/kernel/Makefile  |  2 --
  arch/hexagon/kernel/screen_info.c |  3 ---
  arch/mips/jazz/setup.c|  9 -
  arch/nios2/kernel/setup.c |  5 -
  arch/sh/kernel/setup.c|  5 -
  arch/sparc/kernel/setup_32.c  | 13 -
  arch/sparc/kernel/setup_64.c  | 13 -
  arch/xtensa/kernel/setup.c| 12 
  9 files changed, 74 deletions(-)
  delete mode 100644 arch/hexagon/kernel/screen_info.c


Reviewed-by: Philippe Mathieu-Daudé 



Re: [PATCH v7 6/6] PCI: Make use of pci_resource_n()

2023-03-24 Thread Philippe Mathieu-Daudé

On 23/3/23 18:36, Andy Shevchenko wrote:

Replace open-coded implementations of pci_resource_n() in pci.h.

Signed-off-by: Andy Shevchenko 
---
  include/linux/pci.h | 14 ++
  1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/include/linux/pci.h b/include/linux/pci.h
index 70a4684d5f26..9539cf63fe5e 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -2006,14 +2006,12 @@ int pci_iobar_pfn(struct pci_dev *pdev, int bar, struct 
vm_area_struct *vma);
   * for accessing popular PCI BAR info
   */
  #define pci_resource_n(dev, bar)  (&(dev)->resource[(bar)])
-#define pci_resource_start(dev, bar)   ((dev)->resource[(bar)].start)
-#define pci_resource_end(dev, bar) ((dev)->resource[(bar)].end)
-#define pci_resource_flags(dev, bar)   ((dev)->resource[(bar)].flags)
-#define pci_resource_len(dev,bar) \
-   ((pci_resource_end((dev), (bar)) == 0) ? 0 :\
-   \
-(pci_resource_end((dev), (bar)) -  \
- pci_resource_start((dev), (bar)) + 1))
+#define pci_resource_start(dev, bar)   (pci_resource_n(dev, bar)->start)
+#define pci_resource_end(dev, bar) (pci_resource_n(dev, bar)->end)
+#define pci_resource_flags(dev, bar)   (pci_resource_n(dev, bar)->flags)
+#define pci_resource_len(dev,bar)  \
+   (pci_resource_end((dev), (bar)) ?   \
+resource_size(pci_resource_n((dev), (bar))) : 0)


Seems (to me) more logical to have this patch as "PCI: Introduce 
pci_resource_n()" ordered before your patch #2 "PCI: Introduce 
pci_dev_for_each_resource()".


Here as #6 or as #2:
Reviewed-by: Philippe Mathieu-Daudé 


Re: [PATCH v7 4/6] EISA: Convert to use less arguments in pci_bus_for_each_resource()

2023-03-24 Thread Philippe Mathieu-Daudé

On 23/3/23 18:36, Andy Shevchenko wrote:

The pci_bus_for_each_resource() can hide the iterator loop since
it may be not used otherwise. With this, we may drop that iterator
variable definition.

Signed-off-by: Andy Shevchenko 
Reviewed-by: Krzysztof Wilczyński 
---
  drivers/eisa/pci_eisa.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/eisa/pci_eisa.c b/drivers/eisa/pci_eisa.c


Since this is *PCI* EISA, could be squashed into previous patch.

Reviewed-by: Philippe Mathieu-Daudé 



Re: [PATCH v7 3/6] PCI: Allow pci_bus_for_each_resource() to take less arguments

2023-03-24 Thread Philippe Mathieu-Daudé

On 23/3/23 18:36, Andy Shevchenko wrote:

Refactor pci_bus_for_each_resource() in the same way as it's done in
pci_dev_for_each_resource() case. This will allow to hide iterator
inside the loop, where it's not used otherwise.

No functional changes intended.

Signed-off-by: Andy Shevchenko 
Reviewed-by: Krzysztof Wilczyński 
---
  drivers/pci/bus.c  |  7 +++
  drivers/pci/hotplug/shpchp_sysfs.c |  8 
  drivers/pci/pci.c  |  3 +--
  drivers/pci/probe.c|  2 +-
  drivers/pci/setup-bus.c| 10 --
  include/linux/pci.h| 17 +
  6 files changed, 26 insertions(+), 21 deletions(-)


Nice.

Reviewed-by: Philippe Mathieu-Daudé 



Re: [PATCH v5 00/26] Remove COMMAND_LINE_SIZE from uapi

2023-03-06 Thread Philippe Mathieu-Daudé

On 6/3/23 11:04, Alexandre Ghiti wrote:

This all came up in the context of increasing COMMAND_LINE_SIZE in the
RISC-V port.  In theory that's a UABI break, as COMMAND_LINE_SIZE is the
maximum length of /proc/cmdline and userspace could staticly rely on
that to be correct.

Usually I wouldn't mess around with changing this sort of thing, but
PowerPC increased it with a5980d064fe2 ("powerpc: Bump COMMAND_LINE_SIZE
to 2048").  There are also a handful of examples of COMMAND_LINE_SIZE
increasing, but they're from before the UAPI split so I'm not quite sure
what that means: e5a6a1c90948 ("powerpc: derive COMMAND_LINE_SIZE from
asm-generic"), 684d2fd48e71 ("[S390] kernel: Append scpdata to kernel
boot command line"), 22242681cff5 ("MIPS: Extend COMMAND_LINE_SIZE"),
and 2b74b85693c7 ("sh: Derive COMMAND_LINE_SIZE from
asm-generic/setup.h.").

It seems to me like COMMAND_LINE_SIZE really just shouldn't have been
part of the uapi to begin with, and userspace should be able to handle
/proc/cmdline of whatever length it turns out to be.  I don't see any
references to COMMAND_LINE_SIZE anywhere but Linux via a quick Google
search, but that's not really enough to consider it unused on my end.

This issue was already considered in s390 and they reached the same
conclusion in commit 622021cd6c56 ("s390: make command line
configurable").

The feedback on the v1 seemed to indicate that COMMAND_LINE_SIZE really
shouldn't be part of uapi, so this now touches all the ports.  I've
tried to split this all out and leave it bisectable, but I haven't
tested it all that aggressively.


Series:
Reviewed-by: Philippe Mathieu-Daudé 



Re: [PATCH v2.1 04/24] arm64/cpu: Mark cpu_die() __noreturn

2023-03-02 Thread Philippe Mathieu-Daudé

On 16/2/23 19:41, Josh Poimboeuf wrote:

cpu_die() doesn't return.  Annotate it as such.  By extension this also
makes arch_cpu_idle_dead() noreturn.

Acked-by: Mark Rutland 
Signed-off-by: Josh Poimboeuf 
---
  arch/arm64/include/asm/smp.h | 2 +-
  arch/arm64/kernel/smp.c  | 2 +-
  2 files changed, 2 insertions(+), 2 deletions(-)


Reviewed-by: Philippe Mathieu-Daudé 



Re: [PATCH v2.1 09/24] mips/cpu: Expose play_dead()'s prototype definition

2023-03-02 Thread Philippe Mathieu-Daudé

On 1/3/23 19:16, Josh Poimboeuf wrote:


The latest version of this patch triggered a new kbuild warning which is
fixed by the below patch.  If there are no objections I'll bundle it in
with the rest of the set for merging.

---8<---

Subject: [PATCH] mips/smp: Add CONFIG_SMP guard for raw_smp_processor_id()
Content-type: text/plain

Without CONFIG_SMP, raw_smp_processor_id() is not expected to be defined
by the arch.

Reported-by: kernel test robot 
Link: https://lore.kernel.org/oe-kbuild-all/202302220755.hm8j8gor-...@intel.com/
Signed-off-by: Josh Poimboeuf 
---
  arch/mips/include/asm/smp.h | 2 ++
  1 file changed, 2 insertions(+)

diff --git a/arch/mips/include/asm/smp.h b/arch/mips/include/asm/smp.h
index 4eee29b7845c..cf992b8b1e46 100644
--- a/arch/mips/include/asm/smp.h
+++ b/arch/mips/include/asm/smp.h
@@ -25,6 +25,7 @@ extern cpumask_t cpu_sibling_map[];
  extern cpumask_t cpu_core_map[];
  extern cpumask_t cpu_foreign_map[];
  
+#ifdef CONFIG_SMP

  static inline int raw_smp_processor_id(void)
  {
  #if defined(__VDSO__)
@@ -36,6 +37,7 @@ static inline int raw_smp_processor_id(void)
  #endif
  }
  #define raw_smp_processor_id raw_smp_processor_id
+#endif
  
  /* Map from cpu id to sequential logical cpu number.  This will only

 not be idempotent when cpus failed to come on-line.*/


Reviewed-by: Philippe Mathieu-Daudé 



Re: [PATCH v2 09/24] mips/cpu: Expose play_dead()'s prototype definition

2023-02-15 Thread Philippe Mathieu-Daudé

On 14/2/23 19:11, Josh Poimboeuf wrote:

On Tue, Feb 14, 2023 at 08:46:41AM +0100, Philippe Mathieu-Daudé wrote:

Hi Josh,

On 14/2/23 08:05, Josh Poimboeuf wrote:

Include  to make sure play_dead() matches its prototype going
forward.

Acked-by: Florian Fainelli 
Signed-off-by: Josh Poimboeuf 
---
   arch/mips/kernel/smp-bmips.c | 1 +
   1 file changed, 1 insertion(+)

diff --git a/arch/mips/kernel/smp-bmips.c b/arch/mips/kernel/smp-bmips.c
index f5d7bfa3472a..df9158e8329d 100644
--- a/arch/mips/kernel/smp-bmips.c
+++ b/arch/mips/kernel/smp-bmips.c
@@ -38,6 +38,7 @@
   #include 
   #include 
   #include 
+#include 


What about the other implementations?

$ git grep -L asm/smp.h $(git grep -wlF 'play_dead(void)' arch/mips)
arch/mips/cavium-octeon/smp.c
arch/mips/kernel/smp-bmips.c
arch/mips/kernel/smp-cps.c
arch/mips/loongson64/smp.c


Indeed.  I really wish we had -Wmissing-prototypes.

I'll squash this in:

diff --git a/arch/mips/cavium-octeon/smp.c b/arch/mips/cavium-octeon/smp.c
index 89954f5f87fb..4212584e6efa 100644
--- a/arch/mips/cavium-octeon/smp.c
+++ b/arch/mips/cavium-octeon/smp.c
@@ -20,6 +20,7 @@
  #include 
  #include 
  #include 
+#include 
  
  #include 
  
diff --git a/arch/mips/kernel/smp-cps.c b/arch/mips/kernel/smp-cps.c

index bcd6a944b839..6d69a9ba8167 100644
--- a/arch/mips/kernel/smp-cps.c
+++ b/arch/mips/kernel/smp-cps.c
@@ -20,6 +20,7 @@
  #include 
  #include 
  #include 
+#include 
  #include 
  #include 
  #include 
diff --git a/arch/mips/loongson64/smp.c b/arch/mips/loongson64/smp.c
index c81c2bd07c62..df8d789ede3c 100644
--- a/arch/mips/loongson64/smp.c
+++ b/arch/mips/loongson64/smp.c
@@ -14,6 +14,7 @@
  #include 
  #include 
  #include 
+#include 
  #include 
  #include 
  #include 


Reviewed-by: Philippe Mathieu-Daudé 

Thanks.


Re: [PATCH v2 00/24] cpu,sched: Mark arch_cpu_idle_dead() __noreturn

2023-02-14 Thread Philippe Mathieu-Daudé

On 14/2/23 08:05, Josh Poimboeuf wrote:

v2:
- make arch_call_rest_init() and rest_init() __noreturn
- make objtool 'global_returns' work for weak functions
- rebase on tip/objtool/core with dependencies merged in (mingo)
- add acks

v1.1:
- add __noreturn to all arch_cpu_idle_dead() implementations (mpe)


Possible similar candidates: panic_smp_self_stop, nmi_panic_self_stop
and kexec.



Re: [PATCH v3 19/24] parisc: Remove empty

2023-02-14 Thread Philippe Mathieu-Daudé

On 14/2/23 08:49, Alexandre Ghiti wrote:

From: Palmer Dabbelt 

Signed-off-by: Palmer Dabbelt 
---
  arch/parisc/include/uapi/asm/setup.h | 5 -
  1 file changed, 5 deletions(-)
  delete mode 100644 arch/parisc/include/uapi/asm/setup.h


Reviewed-by: Philippe Mathieu-Daudé 



Re: [PATCH v3 08/24] parisc: Remove COMMAND_LINE_SIZE from uapi

2023-02-14 Thread Philippe Mathieu-Daudé

On 14/2/23 08:49, Alexandre Ghiti wrote:

From: Palmer Dabbelt 

As far as I can tell this is not used by userspace and thus should not
be part of the user-visible API.

Signed-off-by: Palmer Dabbelt 
---
  arch/parisc/include/asm/setup.h  | 7 +++
  arch/parisc/include/uapi/asm/setup.h | 2 --
  2 files changed, 7 insertions(+), 2 deletions(-)
  create mode 100644 arch/parisc/include/asm/setup.h


Reviewed-by: Philippe Mathieu-Daudé 



Re: [PATCH v3 01/24] alpha: Remove COMMAND_LINE_SIZE from uapi

2023-02-14 Thread Philippe Mathieu-Daudé

On 14/2/23 08:49, Alexandre Ghiti wrote:

From: Palmer Dabbelt 

As far as I can tell this is not used by userspace and thus should not
be part of the user-visible API.

Signed-off-by: Palmer Dabbelt 
---
  arch/alpha/include/asm/setup.h  | 4 ++--
  arch/alpha/include/uapi/asm/setup.h | 2 --
  2 files changed, 2 insertions(+), 4 deletions(-)


Reviewed-by: Philippe Mathieu-Daudé 



Re: [PATCH v3 07/24] mips: Remove COMMAND_LINE_SIZE from uapi

2023-02-14 Thread Philippe Mathieu-Daudé

On 14/2/23 08:49, Alexandre Ghiti wrote:

From: Palmer Dabbelt 

As far as I can tell this is not used by userspace and thus should not
be part of the user-visible API.

Signed-off-by: Palmer Dabbelt 
---
  arch/mips/include/asm/setup.h  | 3 ++-
  arch/mips/include/uapi/asm/setup.h | 3 ---
  2 files changed, 2 insertions(+), 4 deletions(-)


Reviewed-by: Philippe Mathieu-Daudé 



Re: [PATCH v3 14/24] arc: Remove empty

2023-02-14 Thread Philippe Mathieu-Daudé

On 14/2/23 08:49, Alexandre Ghiti wrote:

From: Palmer Dabbelt 

Signed-off-by: Palmer Dabbelt 
---
  arch/arc/include/asm/setup.h  | 1 -
  arch/arc/include/uapi/asm/setup.h | 6 --
  2 files changed, 7 deletions(-)
  delete mode 100644 arch/arc/include/uapi/asm/setup.h


Reviewed-by: Philippe Mathieu-Daudé 



Re: [PATCH v3 24/24] s390: Remove empty

2023-02-14 Thread Philippe Mathieu-Daudé

On 14/2/23 08:49, Alexandre Ghiti wrote:

From: Palmer Dabbelt 

Signed-off-by: Palmer Dabbelt 
---
  arch/s390/include/asm/setup.h  | 1 -
  arch/s390/include/uapi/asm/setup.h | 1 -
  2 files changed, 2 deletions(-)
  delete mode 100644 arch/s390/include/uapi/asm/setup.h


Reviewed-by: Philippe Mathieu-Daudé 



Re: [PATCH v3 20/24] x86: Remove empty

2023-02-14 Thread Philippe Mathieu-Daudé

On 14/2/23 08:49, Alexandre Ghiti wrote:

From: Palmer Dabbelt 

Signed-off-by: Palmer Dabbelt 
---
  arch/x86/include/asm/setup.h  | 2 --
  arch/x86/include/uapi/asm/setup.h | 1 -
  2 files changed, 3 deletions(-)
  delete mode 100644 arch/x86/include/uapi/asm/setup.h


Reviewed-by: Philippe Mathieu-Daudé 



Re: [PATCH v2 04/24] arm64/cpu: Mark cpu_die() __noreturn

2023-02-14 Thread Philippe Mathieu-Daudé

On 14/2/23 08:05, Josh Poimboeuf wrote:

cpu_die() doesn't return.  Annotate it as such.  By extension this also
makes arch_cpu_idle_dead() noreturn.

Signed-off-by: Josh Poimboeuf 
---
  arch/arm64/include/asm/smp.h | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm64/include/asm/smp.h b/arch/arm64/include/asm/smp.h
index fc55f5a57a06..5733a31bab08 100644
--- a/arch/arm64/include/asm/smp.h
+++ b/arch/arm64/include/asm/smp.h
@@ -100,7 +100,7 @@ static inline void arch_send_wakeup_ipi_mask(const struct 
cpumask *mask)
  extern int __cpu_disable(void);
  
  extern void __cpu_die(unsigned int cpu);

-extern void cpu_die(void);
+extern void __noreturn cpu_die(void);
  extern void cpu_die_early(void);


Shouldn't cpu_operations::cpu_die() be declared noreturn first?



Re: [PATCH v2 06/24] ia64/cpu: Mark play_dead() __noreturn

2023-02-14 Thread Philippe Mathieu-Daudé

On 14/2/23 08:05, Josh Poimboeuf wrote:

play_dead() doesn't return.  Annotate it as such.  By extension this
also makes arch_cpu_idle_dead() noreturn.

Signed-off-by: Josh Poimboeuf 
---
  arch/ia64/kernel/process.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)


Reviewed-by: Philippe Mathieu-Daudé 



Re: [PATCH v2 08/24] loongarch/cpu: Mark play_dead() __noreturn

2023-02-14 Thread Philippe Mathieu-Daudé

On 14/2/23 08:05, Josh Poimboeuf wrote:

play_dead() doesn't return.  Annotate it as such.  By extension this
also makes arch_cpu_idle_dead() noreturn.

Signed-off-by: Josh Poimboeuf 
---
  arch/loongarch/include/asm/smp.h | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)


Reviewed-by: Philippe Mathieu-Daudé 




Re: [PATCH v2 17/24] x86/cpu: Make sure play_dead() doesn't return

2023-02-14 Thread Philippe Mathieu-Daudé

On 14/2/23 08:05, Josh Poimboeuf wrote:

After commit 076cbf5d2163 ("x86/xen: don't let xen_pv_play_dead()
return"), play_dead() never returns.  Make that more explicit with a
BUG().

BUG() is preferable to unreachable() because BUG() is a more explicit
failure mode and avoids undefined behavior like falling off the edge of
the function into whatever code happens to be next.

Signed-off-by: Josh Poimboeuf 
---
  arch/x86/include/asm/smp.h | 1 +
  1 file changed, 1 insertion(+)

diff --git a/arch/x86/include/asm/smp.h b/arch/x86/include/asm/smp.h
index b4dbb20dab1a..8f628e08b25a 100644
--- a/arch/x86/include/asm/smp.h
+++ b/arch/x86/include/asm/smp.h
@@ -96,6 +96,7 @@ static inline void __cpu_die(unsigned int cpu)
  static inline void play_dead(void)
  {
smp_ops.play_dead();
+   BUG();
  }


Similarly, smp_ops::play_dead() should be decorated noreturn first.


Re: [PATCH v2 13/24] sh/cpu: Make sure play_dead() doesn't return

2023-02-13 Thread Philippe Mathieu-Daudé

On 14/2/23 08:05, Josh Poimboeuf wrote:

play_dead() doesn't return.  Make that more explicit with a BUG().

BUG() is preferable to unreachable() because BUG() is a more explicit
failure mode and avoids undefined behavior like falling off the edge of
the function into whatever code happens to be next.

Signed-off-by: Josh Poimboeuf 
---
  arch/sh/include/asm/smp-ops.h | 1 +
  1 file changed, 1 insertion(+)

diff --git a/arch/sh/include/asm/smp-ops.h b/arch/sh/include/asm/smp-ops.h
index e27702130eb6..63866b1595a0 100644
--- a/arch/sh/include/asm/smp-ops.h
+++ b/arch/sh/include/asm/smp-ops.h
@@ -27,6 +27,7 @@ static inline void plat_smp_setup(void)
  static inline void play_dead(void)
  {
mp_ops->play_dead();
+   BUG();
  }


Shouldn't we decorate plat_smp_ops::play_dead() as noreturn first?


Re: [PATCH v2 19/24] xtensa/cpu: Make sure cpu_die() doesn't return

2023-02-13 Thread Philippe Mathieu-Daudé

Hi Josh,

On 14/2/23 08:05, Josh Poimboeuf wrote:

cpu_die() doesn't return.  Make that more explicit with a BUG().

BUG() is preferable to unreachable() because BUG() is a more explicit
failure mode and avoids undefined behavior like falling off the edge of
the function into whatever code happens to be next.

Signed-off-by: Josh Poimboeuf 
---
  arch/xtensa/kernel/smp.c | 2 ++
  1 file changed, 2 insertions(+)

diff --git a/arch/xtensa/kernel/smp.c b/arch/xtensa/kernel/smp.c
index 4dc109dd6214..7bad78495536 100644
--- a/arch/xtensa/kernel/smp.c
+++ b/arch/xtensa/kernel/smp.c


Can you update the documentation along? Currently we have:

  /*
   * Called from the idle thread for the CPU which has been shutdown.
   *
   * Note that we disable IRQs here, but do not re-enable them
   * before returning to the caller. This is also the behaviour
   * of the other hotplug-cpu capable cores, so presumably coming
   * out of idle fixes this.
   */


@@ -341,6 +341,8 @@ void __ref cpu_die(void)
__asm__ __volatile__(
"  movia2, cpu_restart\n"
"  jx  a2\n");
+
+   BUG();
  }
  
  #endif /* CONFIG_HOTPLUG_CPU */




Re: [PATCH v2 16/24] sparc/cpu: Mark cpu_play_dead() __noreturn

2023-02-13 Thread Philippe Mathieu-Daudé

On 14/2/23 08:05, Josh Poimboeuf wrote:

cpu_play_dead() doesn't return.  Annotate it as such.  By extension this
also makes arch_cpu_idle_dead() noreturn.

Signed-off-by: Josh Poimboeuf 
---
  arch/sparc/include/asm/smp_64.h | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)


Reviewed-by: Philippe Mathieu-Daudé 



Re: [PATCH v2 11/24] mips/cpu: Mark play_dead() __noreturn

2023-02-13 Thread Philippe Mathieu-Daudé

On 14/2/23 08:05, Josh Poimboeuf wrote:

play_dead() doesn't return.  Annotate it as such.  By extension this
also makes arch_cpu_idle_dead() noreturn.

Acked-by: Florian Fainelli 
Signed-off-by: Josh Poimboeuf 
---
  arch/mips/include/asm/smp.h | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)


Reviewed-by: Philippe Mathieu-Daudé 




Re: [PATCH v2 10/24] mips/cpu: Make sure play_dead() doesn't return

2023-02-13 Thread Philippe Mathieu-Daudé

On 14/2/23 08:05, Josh Poimboeuf wrote:

play_dead() doesn't return.  Make that more explicit with a BUG().

BUG() is preferable to unreachable() because BUG() is a more explicit
failure mode and avoids undefined behavior like falling off the edge of
the function into whatever code happens to be next.

Acked-by: Florian Fainelli 
Signed-off-by: Josh Poimboeuf 
---
  arch/mips/kernel/smp-bmips.c | 2 ++
  arch/mips/loongson64/smp.c   | 1 +
  2 files changed, 3 insertions(+)


Reviewed-by: Philippe Mathieu-Daudé 



Re: [PATCH v2 09/24] mips/cpu: Expose play_dead()'s prototype definition

2023-02-13 Thread Philippe Mathieu-Daudé

Hi Josh,

On 14/2/23 08:05, Josh Poimboeuf wrote:

Include  to make sure play_dead() matches its prototype going
forward.

Acked-by: Florian Fainelli 
Signed-off-by: Josh Poimboeuf 
---
  arch/mips/kernel/smp-bmips.c | 1 +
  1 file changed, 1 insertion(+)

diff --git a/arch/mips/kernel/smp-bmips.c b/arch/mips/kernel/smp-bmips.c
index f5d7bfa3472a..df9158e8329d 100644
--- a/arch/mips/kernel/smp-bmips.c
+++ b/arch/mips/kernel/smp-bmips.c
@@ -38,6 +38,7 @@
  #include 
  #include 
  #include 
+#include 


What about the other implementations?

$ git grep -L asm/smp.h $(git grep -wlF 'play_dead(void)' arch/mips)
arch/mips/cavium-octeon/smp.c
arch/mips/kernel/smp-bmips.c
arch/mips/kernel/smp-cps.c
arch/mips/loongson64/smp.c



Re: [PATCH 00/11] Fix pca954x i2c-mux node names

2022-12-03 Thread Philippe Mathieu-Daudé

On 2/12/22 17:49, Geert Uytterhoeven wrote:

Hi all,

According to the I2C bus multiplexer/switch DT bindings, i2c-mux nodes
should be named "i2c-mux" (or something similar).
This patch series renames nodes for pca954x i2c-muxes that are flagged
by

 make dtbs_checK 
DT_SCHEMA_FILES=Documentation/devicetree/bindings/i2c/i2c-mux-pca954x.yaml

Please apply where appropriate.
Thanks!

Geert Uytterhoeven (11):
   ARM: dts: ti: Fix pca954x i2c-mux node names
   ARM: dts: aspeed: Fix pca954x i2c-mux node names
   ARM: dts: imx: Fix pca9547 i2c-mux node name
   ARM: dts: nuvoton: Fix pca954x i2c-mux node names
   ARM: dts: socfpga: Fix pca9548 i2c-mux node name
   ARM: dts: vf610: Fix pca9548 i2c-mux node names
   arm64: dts: freescale: Fix pca954x i2c-mux node names
   arm64: dts: marvell: Fix pca954x i2c-mux node names
   arm64: dts: renesas: ulcb-kf: Fix pca9548 i2c-mux node names
   MIPS: mscc: jaguar2: Fix pca9545 i2c-mux node names
   powerpc: dts: fsl: Fix pca954x i2c-mux node names


Series:
Reviewed-by: Philippe Mathieu-Daudé 



Re: [PATCH v2 21/50] KVM: MIPS: Hardcode callbacks to hardware virtualization extensions

2022-12-01 Thread Philippe Mathieu-Daudé

On 1/12/22 00:09, Sean Christopherson wrote:

Now that KVM no longer supports trap-and-emulate (see commit 45c7e8af4a5e
"MIPS: Remove KVM_TE support"), hardcode the MIPS callbacks to the
virtualization callbacks.

Harcoding the callbacks eliminates the technically-unnecessary check on
non-NULL kvm_mips_callbacks in kvm_arch_init().  MIPS has never supported
multiple in-tree modules, i.e. barring an out-of-tree module, where
copying and renaming kvm.ko counts as "out-of-tree", KVM could never
encounter a non-NULL set of callbacks during module init.

The callback check is also subtly broken, as it is not thread safe,
i.e. if there were multiple modules, loading both concurrently would
create a race between checking and setting kvm_mips_callbacks.

Given that out-of-tree shenanigans are not the kernel's responsibility,
hardcode the callbacks to simplify the code.

Signed-off-by: Sean Christopherson 
---
  arch/mips/include/asm/kvm_host.h |  2 +-
  arch/mips/kvm/Makefile   |  2 +-
  arch/mips/kvm/callback.c | 14 --
  arch/mips/kvm/mips.c |  9 ++---
  arch/mips/kvm/vz.c   |  7 ---
  5 files changed, 8 insertions(+), 26 deletions(-)
  delete mode 100644 arch/mips/kvm/callback.c

diff --git a/arch/mips/include/asm/kvm_host.h b/arch/mips/include/asm/kvm_host.h
index 28f0ba97db71..2803c9c21ef9 100644
--- a/arch/mips/include/asm/kvm_host.h
+++ b/arch/mips/include/asm/kvm_host.h
@@ -758,7 +758,7 @@ struct kvm_mips_callbacks {
void (*vcpu_reenter)(struct kvm_vcpu *vcpu);
  };
  extern struct kvm_mips_callbacks *kvm_mips_callbacks;


IIUC we could even constify this pointer.

Anyway,
Reviewed-by: Philippe Mathieu-Daudé 


diff --git a/arch/mips/kvm/mips.c b/arch/mips/kvm/mips.c
index af29490d9740..f0a6c245d1ff 100644
--- a/arch/mips/kvm/mips.c
+++ b/arch/mips/kvm/mips.c
@@ -1012,17 +1012,12 @@ long kvm_arch_vm_ioctl(struct file *filp, unsigned int 
ioctl, unsigned long arg)
  
  int kvm_arch_init(void *opaque)

  {
-   if (kvm_mips_callbacks) {
-   kvm_err("kvm: module already exists\n");
-   return -EEXIST;
-   }
-
-   return kvm_mips_emulation_init(_mips_callbacks);
+   return kvm_mips_emulation_init();
  }
  
  void kvm_arch_exit(void)

  {
-   kvm_mips_callbacks = NULL;
+
  }
  
  int kvm_arch_vcpu_ioctl_get_sregs(struct kvm_vcpu *vcpu,

diff --git a/arch/mips/kvm/vz.c b/arch/mips/kvm/vz.c
index c706f5890a05..dafab003ea0d 100644
--- a/arch/mips/kvm/vz.c
+++ b/arch/mips/kvm/vz.c
@@ -3304,7 +3304,10 @@ static struct kvm_mips_callbacks kvm_vz_callbacks = {
.vcpu_reenter = kvm_vz_vcpu_reenter,
  };
  
-int kvm_mips_emulation_init(struct kvm_mips_callbacks **install_callbacks)

+/* FIXME: Get rid of the callbacks now that trap-and-emulate is gone. */
+struct kvm_mips_callbacks *kvm_mips_callbacks = _vz_callbacks;


Re: [PATCH 17/44] KVM: arm64: Do arm/arch initialiation without bouncing through kvm_init()

2022-11-03 Thread Philippe Mathieu-Daudé

Hi Sean,

On 3/11/22 00:18, Sean Christopherson wrote:

Move arm/arch specific initialization directly in arm's module_init(),
now called kvm_arm_init(), instead of bouncing through kvm_init() to
reach kvm_arch_init().  Invoking kvm_arch_init() is the very first action
performed by kvm_init(), i.e. this is a glorified nop.

Making kvm_arch_init() a nop will allow dropping it entirely once all
other architectures follow suit.

No functional change intended.

Signed-off-by: Sean Christopherson 
---
  arch/arm64/kvm/arm.c | 25 -
  1 file changed, 16 insertions(+), 9 deletions(-)



  /* NOP: Compiling as a module not supported */
  void kvm_arch_exit(void)
  {
-   kvm_unregister_perf_callbacks();


Doesn't this belong to the previous patch?


+
  }




Re: [PATCH 30/44] KVM: Drop kvm_arch_check_processor_compat() hook

2022-11-03 Thread Philippe Mathieu-Daudé

On 3/11/22 00:18, Sean Christopherson wrote:

Drop kvm_arch_check_processor_compat() and its support code now that all
architecture implementations are nops.

Signed-off-by: Sean Christopherson 
---
  arch/arm64/kvm/arm.c   |  7 +--
  arch/mips/kvm/mips.c   |  7 +--
  arch/powerpc/kvm/book3s.c  |  2 +-
  arch/powerpc/kvm/e500.c|  2 +-
  arch/powerpc/kvm/e500mc.c  |  2 +-
  arch/powerpc/kvm/powerpc.c |  5 -
  arch/riscv/kvm/main.c  |  7 +--
  arch/s390/kvm/kvm-s390.c   |  7 +--
  arch/x86/kvm/svm/svm.c |  4 ++--
  arch/x86/kvm/vmx/vmx.c |  4 ++--
  arch/x86/kvm/x86.c |  5 -
  include/linux/kvm_host.h   |  4 +---
  virt/kvm/kvm_main.c| 24 +---
  13 files changed, 13 insertions(+), 67 deletions(-)


Reviewed-by: Philippe Mathieu-Daudé 



Re: [PATCH 27/44] KVM: Drop kvm_arch_{init,exit}() hooks

2022-11-03 Thread Philippe Mathieu-Daudé

On 3/11/22 00:18, Sean Christopherson wrote:

Drop kvm_arch_init() and kvm_arch_exit() now that all implementations
are nops.

No functional change intended.

Signed-off-by: Sean Christopherson 
---
  arch/arm64/kvm/arm.c| 11 ---
  arch/mips/kvm/mips.c| 10 --
  arch/powerpc/include/asm/kvm_host.h |  1 -
  arch/powerpc/kvm/powerpc.c  |  5 -
  arch/riscv/kvm/main.c   |  9 -
  arch/s390/kvm/kvm-s390.c| 10 --
  arch/x86/kvm/x86.c  | 10 --
  include/linux/kvm_host.h|  3 ---
  virt/kvm/kvm_main.c | 19 ++-
  9 files changed, 2 insertions(+), 76 deletions(-)


Reviewed-by: Philippe Mathieu-Daudé 



Re: [PATCH 25/44] KVM: s390: Do s390 specific init without bouncing through kvm_init()

2022-11-03 Thread Philippe Mathieu-Daudé

On 3/11/22 00:18, Sean Christopherson wrote:

Move the guts of kvm_arch_init() into a new helper, __kvm_s390_init(),
and invoke the new helper directly from kvm_s390_init() instead of
bouncing through kvm_init().  Invoking kvm_arch_init() is the very
first action performed by kvm_init(), i.e. this is a glorified nop.

Moving setup to __kvm_s390_init() will allow tagging more functions as
__init, and emptying kvm_arch_init() will allow dropping the hook
entirely once all architecture implementations are nops.

No functional change intended.

Signed-off-by: Sean Christopherson 
---
  arch/s390/kvm/kvm-s390.c | 29 +
  1 file changed, 25 insertions(+), 4 deletions(-)


Reviewed-by: Philippe Mathieu-Daudé 



Re: [PATCH 22/44] KVM: RISC-V: Do arch init directly in riscv_kvm_init()

2022-11-03 Thread Philippe Mathieu-Daudé

On 3/11/22 00:18, Sean Christopherson wrote:

Fold the guts of kvm_arch_init() into riscv_kvm_init() instead of
bouncing through kvm_init()=>kvm_arch_init().  Functionally, this is a
glorified nop as invoking kvm_arch_init() is the very first action
performed by kvm_init().

Moving setup to riscv_kvm_init(), which is tagged __init, will allow
tagging more functions and data with __init and __ro_after_init.  And
emptying kvm_arch_init() will allow dropping the hook entirely once all
architecture implementations are nops.

No functional change intended.

Signed-off-by: Sean Christopherson 
---
  arch/riscv/kvm/main.c | 18 +-
  1 file changed, 9 insertions(+), 9 deletions(-)


Reviewed-by: Philippe Mathieu-Daudé 



Re: [PATCH 21/44] KVM: MIPS: Register die notifier prior to kvm_init()

2022-11-03 Thread Philippe Mathieu-Daudé

On 3/11/22 00:18, Sean Christopherson wrote:

Call kvm_init() only after _all_ setup is complete, as kvm_init() exposes
/dev/kvm to userspace and thus allows userspace to create VMs (and call
other ioctls).

Signed-off-by: Sean Christopherson 
---
  arch/mips/kvm/mips.c | 9 +
  1 file changed, 5 insertions(+), 4 deletions(-)


Reviewed-by: Philippe Mathieu-Daudé 



Re: [PATCH 20/44] KVM: MIPS: Setup VZ emulation? directly from kvm_mips_init()

2022-11-03 Thread Philippe Mathieu-Daudé

On 3/11/22 00:18, Sean Christopherson wrote:

Invoke kvm_mips_emulation_init() directly from kvm_mips_init() instead
of bouncing through kvm_init()=>kvm_arch_init().  Functionally, this is
a glorified nop as invoking kvm_arch_init() is the very first action
performed by kvm_init().

Emptying kvm_arch_init() will allow dropping the hook entirely once all
architecture implementations are nops.

No functional change intended.

Signed-off-by: Sean Christopherson 
---
  arch/mips/kvm/mips.c | 6 +-
  1 file changed, 5 insertions(+), 1 deletion(-)


Reviewed-by: Philippe Mathieu-Daudé 



Re: [PATCH v1 1/2] stackprotector: move CANARY_MASK and get_random_canary() into stackprotector.h

2022-10-24 Thread Philippe Mathieu-Daudé

On 23/10/22 22:32, Jason A. Donenfeld wrote:

This has nothing to do with random.c and everything to do with stack
protectors. Yes, it uses randomness. But many things use randomness.
random.h and random.c are concerned with the generation of randomness,
not with each and every use. So move this function into the more
specific stackprotector.h file where it belongs.

Signed-off-by: Jason A. Donenfeld 
---
  arch/x86/kernel/cpu/common.c   |  2 +-
  arch/x86/kernel/setup_percpu.c |  2 +-
  arch/x86/kernel/smpboot.c  |  2 +-
  arch/x86/xen/enlighten_pv.c|  2 +-
  include/linux/random.h | 19 ---
  include/linux/stackprotector.h | 19 +++
  kernel/fork.c  |  2 +-
  7 files changed, 24 insertions(+), 24 deletions(-)


Reviewed-by: Philippe Mathieu-Daudé 



Re: [PATCH v4 11/12] KVM: mips, x86: do not rely on KVM_REQ_UNHALT

2022-09-22 Thread Philippe Mathieu-Daudé
On Wed, Sep 21, 2022 at 2:34 AM Sean Christopherson  wrote:
>
> From: Paolo Bonzini 
>
> KVM_REQ_UNHALT is a weird request that simply reports the value of
> kvm_arch_vcpu_runnable() on exit from kvm_vcpu_halt().  Only
> MIPS and x86 are looking at it, the others just clear it.  Check
> the state of the vCPU directly so that the request is handled
> as a nop on all architectures.
>
> No functional change intended, except for corner cases where an
> event arrive immediately after a signal become pending or after
> another similar host-side event.
>
> Signed-off-by: Paolo Bonzini 
> Signed-off-by: Sean Christopherson 
> ---
>  arch/mips/kvm/emulate.c | 7 +++
>  arch/x86/kvm/x86.c  | 9 -
>  2 files changed, 11 insertions(+), 5 deletions(-)

Reviewed-by: Philippe Mathieu-Daudé 


Re: [PATCH 2/5] KVM: mips: Use kvm_get_vcpu() instead of open-coded access

2021-11-06 Thread Philippe Mathieu-Daudé
On Fri, Nov 5, 2021 at 9:14 PM Marc Zyngier  wrote:
>
> As we are about to change the way vcpus are allocated, mandate
> the use of kvm_get_vcpu() instead of open-coding the access.
>
> Signed-off-by: Marc Zyngier 
> ---
>  arch/mips/kvm/loongson_ipi.c | 4 ++--
>  arch/mips/kvm/mips.c | 2 +-
>  2 files changed, 3 insertions(+), 3 deletions(-)

Reviewed-by: Philippe Mathieu-Daudé 


Re: [PATCH 21/20] signal: Replace force_sigsegv(SIGSEGV) with force_fatal_sig(SIGSEGV)

2021-10-21 Thread Philippe Mathieu-Daudé
On Wed, Oct 20, 2021 at 11:52 PM Eric W. Biederman
 wrote:
>
>
> Now that force_fatal_sig exists it is unnecessary and a bit confusing
> to use force_sigsegv in cases where the simpler force_fatal_sig is
> wanted.  So change every instance we can to make the code clearer.
>
> Signed-off-by: "Eric W. Biederman" 
> ---
>  arch/arc/kernel/process.c   | 2 +-
>  arch/m68k/kernel/traps.c| 2 +-
>  arch/powerpc/kernel/signal_32.c | 2 +-
>  arch/powerpc/kernel/signal_64.c | 4 ++--
>  arch/s390/kernel/traps.c| 2 +-
>  arch/um/kernel/trap.c   | 2 +-
>  arch/x86/kernel/vm86_32.c   | 2 +-
>  fs/exec.c   | 2 +-
>  8 files changed, 9 insertions(+), 9 deletions(-)

Reviewed-by: Philippe Mathieu-Daudé 


Re: [PATCH] kvm_host: unify VM_STAT and VCPU_STAT definitions in a single place

2020-04-13 Thread Philippe Mathieu-Daudé
Hi Emanuele,

On 4/13/20 4:03 PM, Emanuele Giuseppe Esposito wrote:
> The macros VM_STAT and VCPU_STAT are redundantly implemented in multiple
> files, each used by a different architecure to initialize the debugfs
> entries for statistics. Since they all have the same purpose, they can be
> unified in a single common definition in include/linux/kvm_host.h
> 
> Signed-off-by: Emanuele Giuseppe Esposito 
> ---
>  arch/arm64/kvm/guest.c| 23 +++
>  arch/mips/kvm/mips.c  | 61 +++
>  arch/powerpc/kvm/book3s.c |  3 --
>  arch/powerpc/kvm/booke.c  |  3 --
>  arch/s390/kvm/kvm-s390.c  |  3 --
>  arch/x86/kvm/x86.c|  3 --
>  include/linux/kvm_host.h  |  3 ++
>  7 files changed, 43 insertions(+), 56 deletions(-)
> 
> diff --git a/arch/arm64/kvm/guest.c b/arch/arm64/kvm/guest.c
> index 23ebe51410f0..3e3aee8b37c0 100644
> --- a/arch/arm64/kvm/guest.c
> +++ b/arch/arm64/kvm/guest.c
> @@ -29,20 +29,17 @@
>  
>  #include "trace.h"
>  
> -#define VM_STAT(x) { #x, offsetof(struct kvm, stat.x), KVM_STAT_VM }
> -#define VCPU_STAT(x) { #x, offsetof(struct kvm_vcpu, stat.x), KVM_STAT_VCPU }
> -
>  struct kvm_stats_debugfs_item debugfs_entries[] = {
> - VCPU_STAT(halt_successful_poll),
> - VCPU_STAT(halt_attempted_poll),
> - VCPU_STAT(halt_poll_invalid),
> - VCPU_STAT(halt_wakeup),
> - VCPU_STAT(hvc_exit_stat),
> - VCPU_STAT(wfe_exit_stat),
> - VCPU_STAT(wfi_exit_stat),
> - VCPU_STAT(mmio_exit_user),
> - VCPU_STAT(mmio_exit_kernel),
> - VCPU_STAT(exits),
> + { "halt_successful_poll", VCPU_STAT(halt_successful_poll) },
> + { "halt_attempted_poll", VCPU_STAT(halt_attempted_poll) },
> + { "halt_poll_invalid", VCPU_STAT(halt_poll_invalid) },
> + { "halt_wakeup", VCPU_STAT(halt_wakeup) },
> + { "hvc_exit_stat", VCPU_STAT(hvc_exit_stat) },
> + { "wfe_exit_stat", VCPU_STAT(wfe_exit_stat) },
> + { "wfi_exit_stat", VCPU_STAT(wfi_exit_stat) },
> + { "mmio_exit_user", VCPU_STAT(mmio_exit_user) },
> + { "mmio_exit_kernel", VCPU_STAT(mmio_exit_kernel) },
> + { "exits", VCPU_STAT(exits) },
>   { NULL }
>  };
>  
[...]
> diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
> index 6d58beb65454..e02d38c7fff1 100644
> --- a/include/linux/kvm_host.h
> +++ b/include/linux/kvm_host.h
> @@ -1130,6 +1130,9 @@ struct kvm_stats_debugfs_item {
>  #define KVM_DBGFS_GET_MODE(dbgfs_item)   
>   \
>   ((dbgfs_item)->mode ? (dbgfs_item)->mode : 0644)
>  
> +#define VM_STAT(x, ...) offsetof(struct kvm, stat.x), KVM_STAT_VM, ## 
> __VA_ARGS__
> +#define VCPU_STAT(x, ...) offsetof(struct kvm_vcpu, stat.x), KVM_STAT_VCPU, 
> ## __VA_ARGS__

I find this macro expanding into multiple fields odd... Maybe a matter
of taste. Sugggestion, have the macro define the full structure, as in
the arm64 arch:

#define VM_STAT(n, x, ...) { n, offsetof(struct kvm, stat.x),
KVM_STAT_VM, ## __VA_ARGS__ }

Ditto for VCPU_STAT().

> +
>  extern struct kvm_stats_debugfs_item debugfs_entries[];
>  extern struct dentry *kvm_debugfs_dir;
>  
>