]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
UBUNTU: SAUCE: rfi-flush: update plpar_get_cpu_characteristics() signature to upstream
authorMauricio Faria de Oliveira <mauricfo@linux.vnet.ibm.com>
Mon, 7 May 2018 22:28:52 +0000 (19:28 -0300)
committerStefan Bader <stefan.bader@canonical.com>
Tue, 15 May 2018 05:35:25 +0000 (07:35 +0200)
This is present in upstream commits:
  191eccb powerpc/pseries: Add H_GET_CPU_CHARACTERISTICS flags & wrapper
  8989d56 powerpc/pseries: Query hypervisor for RFI flush settings

This will help with future backports.

Signed-off-by: Mauricio Faria de Oliveira <mauricfo@linux.vnet.ibm.com>
CVE-2018-3639 (powerpc)

Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
arch/powerpc/include/asm/hvcall.h
arch/powerpc/include/asm/plpar_wrappers.h
arch/powerpc/platforms/pseries/setup.c

index 476d2d78d08fb658a799138898b9af623de1ac10..14ff9c5cfd32db897b16bf0ca253f572ca4db510 100644 (file)
@@ -436,6 +436,11 @@ static inline unsigned int get_longbusy_msecs(int longbusy_rc)
        }
 }
 
+struct h_cpu_char_result {
+       u64 character;
+       u64 behaviour;
+};
+
 #endif /* __ASSEMBLY__ */
 #endif /* __KERNEL__ */
 #endif /* _ASM_POWERPC_HVCALL_H */
index 88a669defa515c236a86ba9b212b8ce9d5fab550..4bcbccbb99f969ce1d14f6d85325430e73667625 100644 (file)
@@ -325,18 +325,16 @@ static inline long plapr_signal_sys_reset(long cpu)
        return plpar_hcall_norets(H_SIGNAL_SYS_RESET, cpu);
 }
 
-static inline long plpar_get_cpu_characteristics(unsigned long *character,
-                                                unsigned long *behavior)
+static inline long plpar_get_cpu_characteristics(struct h_cpu_char_result *p)
 {
-       long rc;
        unsigned long retbuf[PLPAR_HCALL_BUFSIZE];
+       long rc;
 
        rc = plpar_hcall(H_GET_CPU_CHARACTERISTICS, retbuf);
-
-       if (character)
-               *character = retbuf[0];
-       if (behavior)
-               *behavior = retbuf[1];
+       if (rc == H_SUCCESS) {
+               p->character = retbuf[0];
+               p->behaviour = retbuf[1];
+       }
 
        return rc;
 }
index 06d9dc7fb2d96a0c967a14b3f74f54ed620cb571..74f4b0fe7decebf74f109d20ae8c3c351a4b190f 100644 (file)
@@ -457,27 +457,28 @@ static void __init find_and_init_phbs(void)
 
 static void pSeries_setup_rfi_flush(void)
 {
-       unsigned long character, behaviour, rc;
+       struct h_cpu_char_result result;
        enum l1d_flush_type types;
        bool enable;
+       long rc;
 
        /* Enable by default */
        enable = true;
 
-       rc = plpar_get_cpu_characteristics(&character, &behaviour);
+       rc = plpar_get_cpu_characteristics(&result);
        if (rc == H_SUCCESS) {
                types = L1D_FLUSH_NONE;
 
-               if (character & H_CPU_CHAR_L1D_FLUSH_TRIG2)
+               if (result.character & H_CPU_CHAR_L1D_FLUSH_TRIG2)
                        types |= L1D_FLUSH_MTTRIG;
-               if (character & H_CPU_CHAR_L1D_FLUSH_ORI30)
+               if (result.character & H_CPU_CHAR_L1D_FLUSH_ORI30)
                        types |= L1D_FLUSH_ORI;
 
                /* Use fallback if nothing set in hcall */
                if (types == L1D_FLUSH_NONE)
                        types = L1D_FLUSH_FALLBACK;
 
-               if (!(behaviour & H_CPU_BEHAV_L1D_FLUSH_PR))
+               if (!(result.behaviour & H_CPU_BEHAV_L1D_FLUSH_PR))
                        enable = false;
        } else {
                /* Default to fallback if case hcall is not available */