Remove unused Xen microcode patches

They don't apply to Linux 3.16, and current Xen can extract microcode
from the dom0 initramfs.

svn path=/dists/trunk/linux/; revision=21608
This commit is contained in:
Ben Hutchings 2014-07-21 16:10:27 +00:00
parent 659b610ffd
commit d29a1a0e35
5 changed files with 0 additions and 372 deletions

View File

@ -1,38 +0,0 @@
From: Ian Campbell <ijc@hellion.org.uk>
Date: Mon, 26 Nov 2012 09:41:02 +0000
Subject: microcode_xen: Add support for AMD family >= 15h
Origin: https://git.kernel.org/cgit/linux/kernel/git/konrad/xen.git/commit?id=db18162b238275f4ef532c6c1f662116a83b6496
Signed-off-by: Ian Campbell <ijc@hellion.org.uk>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
[bwh: Forward-port to 3.14: adjust filename]
---
arch/x86/kernel/cpu/microcode/xen.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/arch/x86/kernel/cpu/microcode/xen.c b/arch/x86/kernel/cpu/microcode/xen.c
index 6a73957..9e50566 100644
--- a/arch/x86/kernel/cpu/microcode/xen.c
+++ b/arch/x86/kernel/cpu/microcode/xen.c
@@ -58,7 +58,7 @@ static int xen_microcode_update(int cpu)
static enum ucode_state xen_request_microcode_fw(int cpu, struct device *device)
{
- char name[30];
+ char name[36];
struct cpuinfo_x86 *c = &cpu_data(cpu);
const struct firmware *firmware;
struct ucode_cpu_info *uci = ucode_cpu_info + cpu;
@@ -74,7 +74,11 @@ static enum ucode_state xen_request_microcode_fw(int cpu, struct device *device)
break;
case X86_VENDOR_AMD:
- snprintf(name, sizeof(name), "amd-ucode/microcode_amd.bin");
+ /* Beginning with family 15h AMD uses family-specific firmware files. */
+ if (c->x86 >= 0x15)
+ snprintf(name, sizeof(name), "amd-ucode/microcode_amd_fam%.2xh.bin", c->x86);
+ else
+ snprintf(name, sizeof(name), "amd-ucode/microcode_amd.bin");
break;
default:

View File

@ -1,28 +0,0 @@
From: Ian Campbell <ijc@hellion.org.uk>
Date: Wed, 16 Jan 2013 13:38:20 +0000
Subject: microcode_xen: update for changed core API
Forwarded: no
Signed-off-by: Ian Campbell <ijc@hellion.org.uk>
[bwh: Forward-port to 3.14: adjust filename]
---
arch/x86/kernel/cpu/microcode/xen.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/arch/x86/kernel/cpu/microcode/xen.c b/arch/x86/kernel/cpu/microcode/xen.c
index 9e50566..6b7aa48 100644
--- a/arch/x86/kernel/cpu/microcode/xen.c
+++ b/arch/x86/kernel/cpu/microcode/xen.c
@@ -56,7 +56,8 @@ static int xen_microcode_update(int cpu)
return err;
}
-static enum ucode_state xen_request_microcode_fw(int cpu, struct device *device)
+static enum ucode_state xen_request_microcode_fw(int cpu, struct device *device,
+ bool refresh_fw)
{
char name[36];
struct cpuinfo_x86 *c = &cpu_data(cpu);
--
1.7.2.5

View File

@ -1,25 +0,0 @@
From: Ben Guthro <ben@guthro.net>
Date: Thu, 3 Nov 2011 11:06:56 -0400
Subject: x86/microcode: check proper return code.
Origin: https://git.kernel.org/cgit/linux/kernel/git/konrad/xen.git/commit?id=f6c958ff0d00ffbf1cdc8fcf2f2a82f06fbbb5f4
After pulling in this change from your tree, I found the following bug,
when checking an enum value, which should be considered before inclusion:
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
[bwh: Forward-port to 3.14: adjust filename]
---
arch/x86/kernel/cpu/microcode/xen.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/arch/x86/kernel/cpu/microcode/xen.c
+++ b/arch/x86/kernel/cpu/microcode/xen.c
@@ -161,7 +161,7 @@ static enum ucode_state xen_request_micr
ret = UCODE_OK;
out:
- if (ret == 0)
+ if (ret == UCODE_OK)
uci->mc = uc;
else
vfree(uc);

View File

@ -1,275 +0,0 @@
From: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Date: Fri, 27 Mar 2009 17:39:15 -0700
Subject: xen: add CPU microcode update driver
Origin: https://git.kernel.org/cgit/linux/kernel/git/konrad/xen.git/commit?id=773aa13a09e3b1731b25886b5f0de366bf82bb97
Xen does all the hard work for us, including choosing the right update
method for this cpu type and actually doing it for all cpus. We just
need to supply it with the firmware blob.
Because Xen updates all CPUs (and the kernel's virtual cpu numbers have
no fixed relationship with the underlying physical cpus), we only bother
doing anything for cpu "0".
[ Impact: allow CPU microcode update in Xen dom0 ]
Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
[bwh: Forward-port to 3.14: adjust filenames, context]
---
--- a/arch/x86/include/asm/microcode.h
+++ b/arch/x86/include/asm/microcode.h
@@ -86,4 +86,13 @@ static inline int __init save_microcode_
}
#endif
+#ifdef CONFIG_MICROCODE_XEN
+extern struct microcode_ops * __init init_xen_microcode(void);
+#else
+static inline struct microcode_ops * __init init_xen_microcode(void)
+{
+ return NULL;
+}
+#endif
+
#endif /* _ASM_X86_MICROCODE_H */
--- a/arch/x86/kernel/cpu/microcode/Makefile
+++ b/arch/x86/kernel/cpu/microcode/Makefile
@@ -2,6 +2,7 @@ microcode-y := core.o
obj-$(CONFIG_MICROCODE) += microcode.o
microcode-$(CONFIG_MICROCODE_INTEL) += intel.o intel_lib.o
microcode-$(CONFIG_MICROCODE_AMD) += amd.o
+microcode-$(CONFIG_MICROCODE_XEN) += xen.o
obj-$(CONFIG_MICROCODE_EARLY) += core_early.o
obj-$(CONFIG_MICROCODE_INTEL_EARLY) += intel_early.o
obj-$(CONFIG_MICROCODE_AMD_EARLY) += amd_early.o
--- a/arch/x86/kernel/cpu/microcode/core.c
+++ b/arch/x86/kernel/cpu/microcode/core.c
@@ -84,6 +84,7 @@
#include <linux/mm.h>
#include <linux/syscore_ops.h>
+#include <xen/xen.h>
#include <asm/microcode.h>
#include <asm/processor.h>
#include <asm/cpu_device_id.h>
@@ -546,7 +547,9 @@ static int __init microcode_init(void)
struct cpuinfo_x86 *c = &cpu_data(0);
int error;
- if (c->x86_vendor == X86_VENDOR_INTEL)
+ if (xen_pv_domain())
+ microcode_ops = init_xen_microcode();
+ else if (c->x86_vendor == X86_VENDOR_INTEL)
microcode_ops = init_intel_microcode();
else if (c->x86_vendor == X86_VENDOR_AMD)
microcode_ops = init_amd_microcode();
--- /dev/null
+++ b/arch/x86/kernel/cpu/microcode/xen.c
@@ -0,0 +1,198 @@
+/*
+ * Xen microcode update driver
+ *
+ * Xen does most of the work here. We just pass the whole blob into
+ * Xen, and it will apply it to all CPUs as appropriate. Xen will
+ * worry about how different CPU models are actually updated.
+ */
+#include <linux/sched.h>
+#include <linux/module.h>
+#include <linux/firmware.h>
+#include <linux/vmalloc.h>
+#include <linux/uaccess.h>
+
+#include <asm/microcode.h>
+
+#include <xen/xen.h>
+#include <xen/interface/platform.h>
+#include <xen/interface/xen.h>
+
+#include <asm/xen/hypercall.h>
+#include <asm/xen/hypervisor.h>
+
+MODULE_DESCRIPTION("Xen microcode update driver");
+MODULE_LICENSE("GPL");
+
+struct xen_microcode {
+ size_t len;
+ char data[0];
+};
+
+static int xen_microcode_update(int cpu)
+{
+ int err;
+ struct xen_platform_op op;
+ struct ucode_cpu_info *uci = ucode_cpu_info + cpu;
+ struct xen_microcode *uc = uci->mc;
+
+ if (uc == NULL || uc->len == 0) {
+ /*
+ * We do all cpus at once, so we don't need to do
+ * other cpus explicitly (besides, these vcpu numbers
+ * have no relationship to underlying physical cpus).
+ */
+ return 0;
+ }
+
+ op.cmd = XENPF_microcode_update;
+ set_xen_guest_handle(op.u.microcode.data, uc->data);
+ op.u.microcode.length = uc->len;
+
+ err = HYPERVISOR_dom0_op(&op);
+
+ if (err != 0)
+ printk(KERN_WARNING "microcode_xen: microcode update failed: %d\n", err);
+
+ return err;
+}
+
+static enum ucode_state xen_request_microcode_fw(int cpu, struct device *device)
+{
+ char name[30];
+ struct cpuinfo_x86 *c = &cpu_data(cpu);
+ const struct firmware *firmware;
+ struct ucode_cpu_info *uci = ucode_cpu_info + cpu;
+ enum ucode_state ret;
+ struct xen_microcode *uc;
+ size_t size;
+ int err;
+
+ switch (c->x86_vendor) {
+ case X86_VENDOR_INTEL:
+ snprintf(name, sizeof(name), "intel-ucode/%02x-%02x-%02x",
+ c->x86, c->x86_model, c->x86_mask);
+ break;
+
+ case X86_VENDOR_AMD:
+ snprintf(name, sizeof(name), "amd-ucode/microcode_amd.bin");
+ break;
+
+ default:
+ return UCODE_NFOUND;
+ }
+
+ err = request_firmware(&firmware, name, device);
+ if (err) {
+ pr_debug("microcode: data file %s load failed\n", name);
+ return UCODE_NFOUND;
+ }
+
+ /*
+ * Only bother getting real firmware for cpu 0; the others get
+ * dummy placeholders.
+ */
+ if (cpu == 0)
+ size = firmware->size;
+ else
+ size = 0;
+
+ if (uci->mc != NULL) {
+ vfree(uci->mc);
+ uci->mc = NULL;
+ }
+
+ ret = UCODE_ERROR;
+ uc = vmalloc(sizeof(*uc) + size);
+ if (uc == NULL)
+ goto out;
+
+ ret = UCODE_OK;
+ uc->len = size;
+ memcpy(uc->data, firmware->data, uc->len);
+
+ uci->mc = uc;
+
+out:
+ release_firmware(firmware);
+
+ return ret;
+}
+
+static enum ucode_state xen_request_microcode_user(int cpu,
+ const void __user *buf, size_t size)
+{
+ struct ucode_cpu_info *uci = ucode_cpu_info + cpu;
+ struct xen_microcode *uc;
+ enum ucode_state ret;
+ size_t unread;
+
+ if (cpu != 0) {
+ /* No real firmware for non-zero cpus; just store a
+ placeholder */
+ size = 0;
+ }
+
+ if (uci->mc != NULL) {
+ vfree(uci->mc);
+ uci->mc = NULL;
+ }
+
+ ret = UCODE_ERROR;
+ uc = vmalloc(sizeof(*uc) + size);
+ if (uc == NULL)
+ goto out;
+
+ uc->len = size;
+
+ ret = UCODE_NFOUND;
+
+ unread = copy_from_user(uc->data, buf, size);
+
+ if (unread != 0) {
+ printk(KERN_WARNING "failed to read %zd of %zd bytes at %p -> %p\n",
+ unread, size, buf, uc->data);
+ goto out;
+ }
+
+ ret = UCODE_OK;
+
+out:
+ if (ret == 0)
+ uci->mc = uc;
+ else
+ vfree(uc);
+
+ return ret;
+}
+
+static void xen_microcode_fini_cpu(int cpu)
+{
+ struct ucode_cpu_info *uci = ucode_cpu_info + cpu;
+
+ vfree(uci->mc);
+ uci->mc = NULL;
+}
+
+static int xen_collect_cpu_info(int cpu, struct cpu_signature *sig)
+{
+ sig->sig = 0;
+ sig->pf = 0;
+ sig->rev = 0;
+
+ return 0;
+}
+
+static struct microcode_ops microcode_xen_ops = {
+ .request_microcode_user = xen_request_microcode_user,
+ .request_microcode_fw = xen_request_microcode_fw,
+ .collect_cpu_info = xen_collect_cpu_info,
+ .apply_microcode = xen_microcode_update,
+ .microcode_fini_cpu = xen_microcode_fini_cpu,
+};
+
+struct microcode_ops * __init init_xen_microcode(void)
+{
+ if (!xen_initial_domain())
+ return NULL;
+ return &microcode_xen_ops;
+}
--- a/arch/x86/xen/Kconfig
+++ b/arch/x86/xen/Kconfig
@@ -55,3 +55,7 @@ config XEN_PVH
bool "Support for running as a PVH guest"
depends on X86_64 && XEN && XEN_PVHVM
def_bool n
+
+config MICROCODE_XEN
+ def_bool y
+ depends on XEN_DOM0 && MICROCODE

View File

@ -48,12 +48,6 @@ debian/cdc_ncm-cdc_mbim-use-ncm-by-default.patch
debian/snd-pcsp-disable-autoload.patch
bugfix/x86/viafb-autoload-on-olpc-xo1.5-only.patch
# Support for microcode updates under Xen
# features/all/xen/microcode.patch
# features/all/xen/microcode-amd-fam15plus.patch
# features/all/xen/microcode-typo.patch
# features/all/xen/microcode-api-update.patch
# Arch bug fixes
bugfix/arm/omap-musb-choice.patch
bugfix/mips/disable-advansys.patch