From nobody Mon Feb 9 21:12:03 2026 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1566177772; cv=none; d=zoho.com; s=zohoarc; b=ZWHGAsK3fUJOQgIGNBnBqsVm8tbUB6ex7FaRpM59i92EnKeRphRZQKpmYjCcGXkGONHLps9vwwKtaGsEGgSCUzkPi8FeZ+nZNEm5lJxgpC90PJHmFoiqge66TV1zz90AhfBVCLPtoONG6xJ6TQdKRe10K1vDKaS/QXpPHtyMHkc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1566177772; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=hnoxOWh69gD9l9JUEXf99XueIdBzvQQuxORvynKPKWk=; b=hlmWcUDGHdXV4anh9jW56VMxjNYqDhvGeQFx1uZezZ8fM4uQcRH35vRh2Yti4U/V0diUW/Ico6+qKz9e7Kaw6SWzMHSv2XUhHLlw7/SY40NiadoW01L5DvJl3TFn8EhEEKi4bDXDTt7+pgB8JaIMVPNEbM5B6IV0Yi05kc0Zaas= ARC-Authentication-Results: i=1; mx.zoho.com; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 156617777214843.5418226548735; Sun, 18 Aug 2019 18:22:52 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hzWMq-0001GP-Gy; Mon, 19 Aug 2019 01:21:52 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hzWMp-0001F2-6a for xen-devel@lists.xenproject.org; Mon, 19 Aug 2019 01:21:51 +0000 Received: from mga03.intel.com (unknown [134.134.136.65]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id b7af3619-c21f-11e9-8be6-12813bfff9fa; Mon, 19 Aug 2019 01:21:50 +0000 (UTC) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Aug 2019 18:21:50 -0700 Received: from gao-cwp.sh.intel.com ([10.239.159.26]) by orsmga001.jf.intel.com with ESMTP; 18 Aug 2019 18:21:48 -0700 X-Inumbo-ID: b7af3619-c21f-11e9-8be6-12813bfff9fa X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,403,1559545200"; d="scan'208";a="261683912" From: Chao Gao To: xen-devel@lists.xenproject.org Date: Mon, 19 Aug 2019 09:25:22 +0800 Message-Id: <1566177928-19114-10-git-send-email-chao.gao@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1566177928-19114-1-git-send-email-chao.gao@intel.com> References: <1566177928-19114-1-git-send-email-chao.gao@intel.com> Subject: [Xen-devel] [PATCH v9 09/15] microcode: pass a patch pointer to apply_microcode() X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Ashok Raj , Wei Liu , Andrew Cooper , Jan Beulich , Chao Gao , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" apply_microcode()'s always loading the cached ucode patch forces a patch to be stored before being loading. Make apply_microcode() accept a patch pointer to remove the limitation so that a patch can be stored after a successful loading. Signed-off-by: Chao Gao Reviewed-by: Jan Beulich --- xen/arch/x86/microcode.c | 2 +- xen/arch/x86/microcode_amd.c | 5 ++--- xen/arch/x86/microcode_intel.c | 5 ++--- xen/include/asm-x86/microcode.h | 2 +- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/xen/arch/x86/microcode.c b/xen/arch/x86/microcode.c index c9401a7..0e9322a 100644 --- a/xen/arch/x86/microcode.c +++ b/xen/arch/x86/microcode.c @@ -208,7 +208,7 @@ int microcode_resume_cpu(void) =20 err =3D microcode_ops->collect_cpu_info(sig); if ( likely(!err) ) - err =3D microcode_ops->apply_microcode(); + err =3D microcode_ops->apply_microcode(microcode_cache); spin_unlock(µcode_mutex); =20 return err; diff --git a/xen/arch/x86/microcode_amd.c b/xen/arch/x86/microcode_amd.c index b85fb04..21cdfe0 100644 --- a/xen/arch/x86/microcode_amd.c +++ b/xen/arch/x86/microcode_amd.c @@ -248,7 +248,7 @@ static enum microcode_match_result compare_patch( return MIS_UCODE; } =20 -static int apply_microcode(void) +static int apply_microcode(const struct microcode_patch *patch) { unsigned long flags; uint32_t rev; @@ -256,7 +256,6 @@ static int apply_microcode(void) unsigned int cpu =3D smp_processor_id(); struct cpu_signature *sig =3D &per_cpu(cpu_sig, cpu); const struct microcode_header_amd *hdr; - const struct microcode_patch *patch =3D microcode_get_cache(); =20 if ( !match_cpu(patch) ) return -EINVAL; @@ -557,7 +556,7 @@ static int cpu_request_microcode(const void *buf, size_= t bufsize) =20 if ( match_cpu(microcode_get_cache()) ) { - error =3D apply_microcode(); + error =3D apply_microcode(microcode_get_cache()); if ( error ) break; } diff --git a/xen/arch/x86/microcode_intel.c b/xen/arch/x86/microcode_intel.c index a5452d4..8c0008c 100644 --- a/xen/arch/x86/microcode_intel.c +++ b/xen/arch/x86/microcode_intel.c @@ -319,7 +319,7 @@ static int get_matching_microcode(const void *mc) return 1; } =20 -static int apply_microcode(void) +static int apply_microcode(const struct microcode_patch *patch) { unsigned long flags; uint64_t msr_content; @@ -327,7 +327,6 @@ static int apply_microcode(void) unsigned int cpu_num =3D raw_smp_processor_id(); struct cpu_signature *sig =3D &this_cpu(cpu_sig); const struct microcode_intel *mc_intel; - const struct microcode_patch *patch =3D microcode_get_cache(); =20 if ( !match_cpu(patch) ) return -EINVAL; @@ -422,7 +421,7 @@ static int cpu_request_microcode(const void *buf, size_= t size) error =3D offset; =20 if ( !error && match_cpu(microcode_get_cache()) ) - error =3D apply_microcode(); + error =3D apply_microcode(microcode_get_cache()); =20 return error; } diff --git a/xen/include/asm-x86/microcode.h b/xen/include/asm-x86/microcod= e.h index c8d2c4f..8c7de9d 100644 --- a/xen/include/asm-x86/microcode.h +++ b/xen/include/asm-x86/microcode.h @@ -22,7 +22,7 @@ struct microcode_patch { struct microcode_ops { int (*cpu_request_microcode)(const void *buf, size_t size); int (*collect_cpu_info)(struct cpu_signature *csig); - int (*apply_microcode)(void); + int (*apply_microcode)(const struct microcode_patch *patch); int (*start_update)(void); void (*end_update)(void); void (*free_patch)(void *mc); --=20 1.8.3.1 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel