From xen-changelog-bounces@lists.xenproject.org Sat May 01 01:11:13 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 01 May 2021 01:11:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.120809.228423 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lce9x-0006TE-1G; Sat, 01 May 2021 01:11:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 120809.228423; Sat, 01 May 2021 01:11:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lce9w-0006T6-TR; Sat, 01 May 2021 01:11:04 +0000
Received: by outflank-mailman (input) for mailman id 120809;
 Sat, 01 May 2021 01:11:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lce9u-0006T1-Ry
 for xen-changelog@lists.xenproject.org; Sat, 01 May 2021 01:11:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lce9u-0004UZ-NY
 for xen-changelog@lists.xenproject.org; Sat, 01 May 2021 01:11:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lce9u-0004ze-Ly
 for xen-changelog@lists.xenproject.org; Sat, 01 May 2021 01:11:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=TrhQnFW3fUmod6wtplrkFxYRcmJjsLLWSgFQKme5hmY=; b=brhVQlp7KDqu1UVlhCoiFVkcfb
	l3NQKvP8GoBYd7vcumnuP8wo80rZqUvypWDT11GvOyIElTbu9y1ZGJZWjQX6u/Ee03tOsXE01cOjj
	5xWKcDFbc4PB/d2u61Yh5Qdw0imzmzDMDjhOiiGeRIlUyRxT44V3cC0qdLRU8QJf5CRs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] unzstd: replace INIT and STATIC
Message-Id: <E1lce9u-0004ze-Ly@xenbits.xenproject.org>
Date: Sat, 01 May 2021 01:11:02 +0000

commit 2c6af6c7bbaa7c6b6945c0d4cd88aeebec5e85fd
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Apr 29 16:02:59 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 29 16:02:59 2021 +0200

    unzstd: replace INIT and STATIC
    
    With xen/common/decompress.h now agreeing in both build modes about
    what STATIC expands to, there's no need for these abstractions anymore.
    
    Requested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
---
 xen/common/unzstd.c              |  18 ++---
 xen/common/zstd/decompress.c     | 142 +++++++++++++++++++--------------------
 xen/common/zstd/entropy_common.c |  10 +--
 xen/common/zstd/error_private.h  |   8 +--
 xen/common/zstd/fse_decompress.c |  10 +--
 xen/common/zstd/huf_decompress.c |  52 +++++++-------
 xen/common/zstd/zstd_common.c    |  12 ++--
 xen/common/zstd/zstd_internal.h  |   2 +-
 8 files changed, 127 insertions(+), 127 deletions(-)

diff --git a/xen/common/unzstd.c b/xen/common/unzstd.c
index 915a07c21b..a034b69e86 100644
--- a/xen/common/unzstd.c
+++ b/xen/common/unzstd.c
@@ -71,7 +71,7 @@
  */
 #define ZSTD_IOBUF_SIZE		(1 << 17)
 
-static int INIT handle_zstd_error(size_t ret, void (*error)(const char *x))
+static int __init handle_zstd_error(size_t ret, void (*error)(const char *x))
 {
 	const int err = ZSTD_getErrorCode(ret);
 
@@ -102,9 +102,9 @@ static int INIT handle_zstd_error(size_t ret, void (*error)(const char *x))
  * We can allocate less memory (no circular buffer for the sliding window),
  * and avoid some memcpy() calls.
  */
-static int INIT decompress_single(const u8 *in_buf, long in_len, u8 *out_buf,
-				  long out_len, unsigned int *in_pos,
-				  void (*error)(const char *x))
+static int __init decompress_single(const u8 *in_buf, long in_len, u8 *out_buf,
+				    long out_len, unsigned int *in_pos,
+				    void (*error)(const char *x))
 {
 	const size_t wksp_size = ZSTD_DCtxWorkspaceBound();
 	void *wksp = large_malloc(wksp_size);
@@ -142,11 +142,11 @@ out:
 	return err;
 }
 
-int INIT unzstd(unsigned char *in_buf, unsigned int in_len,
-	        int (*fill)(void*, unsigned int),
-	        int (*flush)(void*, unsigned int),
-	        unsigned char *out_buf, unsigned int *in_pos,
-	        void (*error)(const char *x))
+int __init unzstd(unsigned char *in_buf, unsigned int in_len,
+		  int (*fill)(void*, unsigned int),
+		  int (*flush)(void*, unsigned int),
+		  unsigned char *out_buf, unsigned int *in_pos,
+		  void (*error)(const char *x))
 {
 	ZSTD_inBuffer in;
 	ZSTD_outBuffer out;
diff --git a/xen/common/zstd/decompress.c b/xen/common/zstd/decompress.c
index b024910814..1bfd58eb44 100644
--- a/xen/common/zstd/decompress.c
+++ b/xen/common/zstd/decompress.c
@@ -46,7 +46,7 @@
 /*_*******************************************************
 *  Memory operations
 **********************************************************/
-static void INIT ZSTD_copy4(void *dst, const void *src) { memcpy(dst, src, 4); }
+static void __init ZSTD_copy4(void *dst, const void *src) { memcpy(dst, src, 4); }
 
 /*-*************************************************************
 *   Context management
@@ -98,12 +98,12 @@ struct ZSTD_DCtx_s {
 	BYTE headerBuffer[ZSTD_FRAMEHEADERSIZE_MAX];
 }; /* typedef'd to ZSTD_DCtx within "zstd.h" */
 
-STATIC size_t INIT ZSTD_DCtxWorkspaceBound(void)
+static size_t __init ZSTD_DCtxWorkspaceBound(void)
 {
 	return ZSTD_ALIGN(sizeof(ZSTD_stack)) + ZSTD_ALIGN(sizeof(ZSTD_DCtx));
 }
 
-STATIC size_t INIT ZSTD_decompressBegin(ZSTD_DCtx *dctx)
+static size_t __init ZSTD_decompressBegin(ZSTD_DCtx *dctx)
 {
 	dctx->expected = ZSTD_frameHeaderSize_prefix;
 	dctx->stage = ZSTDds_getFrameHeaderSize;
@@ -123,7 +123,7 @@ STATIC size_t INIT ZSTD_decompressBegin(ZSTD_DCtx *dctx)
 	return 0;
 }
 
-STATIC ZSTD_DCtx *INIT ZSTD_createDCtx_advanced(ZSTD_customMem customMem)
+static ZSTD_DCtx *__init ZSTD_createDCtx_advanced(ZSTD_customMem customMem)
 {
 	ZSTD_DCtx *dctx;
 
@@ -138,13 +138,13 @@ STATIC ZSTD_DCtx *INIT ZSTD_createDCtx_advanced(ZSTD_customMem customMem)
 	return dctx;
 }
 
-STATIC ZSTD_DCtx *INIT ZSTD_initDCtx(void *workspace, size_t workspaceSize)
+static ZSTD_DCtx *__init ZSTD_initDCtx(void *workspace, size_t workspaceSize)
 {
 	ZSTD_customMem const stackMem = ZSTD_initStack(workspace, workspaceSize);
 	return ZSTD_createDCtx_advanced(stackMem);
 }
 
-size_t INIT ZSTD_freeDCtx(ZSTD_DCtx *dctx)
+size_t __init ZSTD_freeDCtx(ZSTD_DCtx *dctx)
 {
 	if (dctx == NULL)
 		return 0; /* support free on NULL */
@@ -153,15 +153,15 @@ size_t INIT ZSTD_freeDCtx(ZSTD_DCtx *dctx)
 }
 
 #ifdef BUILD_DEAD_CODE
-void INIT ZSTD_copyDCtx(ZSTD_DCtx *dstDCtx, const ZSTD_DCtx *srcDCtx)
+void __init ZSTD_copyDCtx(ZSTD_DCtx *dstDCtx, const ZSTD_DCtx *srcDCtx)
 {
 	size_t const workSpaceSize = (ZSTD_BLOCKSIZE_ABSOLUTEMAX + WILDCOPY_OVERLENGTH) + ZSTD_frameHeaderSize_max;
 	memcpy(dstDCtx, srcDCtx, sizeof(ZSTD_DCtx) - workSpaceSize); /* no need to copy workspace */
 }
 #endif
 
-STATIC size_t ZSTD_findFrameCompressedSize(const void *src, size_t srcSize);
-STATIC size_t ZSTD_decompressBegin_usingDict(ZSTD_DCtx *dctx, const void *dict,
+static size_t ZSTD_findFrameCompressedSize(const void *src, size_t srcSize);
+static size_t ZSTD_decompressBegin_usingDict(ZSTD_DCtx *dctx, const void *dict,
 	size_t dictSize);
 
 static void ZSTD_refDDict(ZSTD_DCtx *dstDCtx, const ZSTD_DDict *ddict);
@@ -176,7 +176,7 @@ static void ZSTD_refDDict(ZSTD_DCtx *dstDCtx, const ZSTD_DDict *ddict);
  *  Note : Frame Identifier is 4 bytes. If `size < 4`, @return will always be 0.
  *  Note 2 : Legacy Frame Identifiers are considered valid only if Legacy Support is enabled.
  *  Note 3 : Skippable Frame Identifiers are considered valid. */
-unsigned INIT ZSTD_isFrame(const void *buffer, size_t size)
+unsigned __init ZSTD_isFrame(const void *buffer, size_t size)
 {
 	if (size < 4)
 		return 0;
@@ -194,7 +194,7 @@ unsigned INIT ZSTD_isFrame(const void *buffer, size_t size)
 /** ZSTD_frameHeaderSize() :
 *   srcSize must be >= ZSTD_frameHeaderSize_prefix.
 *   @return : size of the Frame Header */
-static size_t INIT ZSTD_frameHeaderSize(const void *src, size_t srcSize)
+static size_t __init ZSTD_frameHeaderSize(const void *src, size_t srcSize)
 {
 	if (srcSize < ZSTD_frameHeaderSize_prefix)
 		return ERROR(srcSize_wrong);
@@ -212,7 +212,7 @@ static size_t INIT ZSTD_frameHeaderSize(const void *src, size_t srcSize)
 *   @return : 0, `fparamsPtr` is correctly filled,
 *            >0, `srcSize` is too small, result is expected `srcSize`,
 *             or an error code, which can be tested using ZSTD_isError() */
-STATIC size_t INIT ZSTD_getFrameParams(ZSTD_frameParams *fparamsPtr, const void *src, size_t srcSize)
+static size_t __init ZSTD_getFrameParams(ZSTD_frameParams *fparamsPtr, const void *src, size_t srcSize)
 {
 	const BYTE *ip = (const BYTE *)src;
 
@@ -303,7 +303,7 @@ STATIC size_t INIT ZSTD_getFrameParams(ZSTD_frameParams *fparamsPtr, const void
 *   @return : decompressed size of the single frame pointed to be `src` if known, otherwise
 *             - ZSTD_CONTENTSIZE_UNKNOWN if the size cannot be determined
 *             - ZSTD_CONTENTSIZE_ERROR if an error occurred (e.g. invalid magic number, srcSize too small) */
-unsigned long long INIT ZSTD_getFrameContentSize(const void *src, size_t srcSize)
+unsigned long long __init ZSTD_getFrameContentSize(const void *src, size_t srcSize)
 {
 	{
 		ZSTD_frameParams fParams;
@@ -325,7 +325,7 @@ unsigned long long INIT ZSTD_getFrameContentSize(const void *src, size_t srcSize
  *  `srcSize` must be the exact length of some number of ZSTD compressed and/or
  *      skippable frames
  *  @return : decompressed size of the frames contained */
-unsigned long long INIT ZSTD_findDecompressedSize(const void *src, size_t srcSize)
+unsigned long long __init ZSTD_findDecompressedSize(const void *src, size_t srcSize)
 {
 	{
 		unsigned long long totalDstSize = 0;
@@ -379,7 +379,7 @@ unsigned long long INIT ZSTD_findDecompressedSize(const void *src, size_t srcSiz
 /** ZSTD_decodeFrameHeader() :
 *   `headerSize` must be the size provided by ZSTD_frameHeaderSize().
 *   @return : 0 if success, or an error code, which can be tested using ZSTD_isError() */
-static size_t INIT ZSTD_decodeFrameHeader(ZSTD_DCtx *dctx, const void *src, size_t headerSize)
+static size_t __init ZSTD_decodeFrameHeader(ZSTD_DCtx *dctx, const void *src, size_t headerSize)
 {
 	size_t const result = ZSTD_getFrameParams(&(dctx->fParams), src, headerSize);
 	if (ZSTD_isError(result))
@@ -401,7 +401,7 @@ typedef struct {
 
 /*! ZSTD_getcBlockSize() :
 *   Provides the size of compressed block from block header `src` */
-STATIC size_t INIT ZSTD_getcBlockSize(const void *src, size_t srcSize, blockProperties_t *bpPtr)
+static size_t __init ZSTD_getcBlockSize(const void *src, size_t srcSize, blockProperties_t *bpPtr)
 {
 	if (srcSize < ZSTD_blockHeaderSize)
 		return ERROR(srcSize_wrong);
@@ -419,7 +419,7 @@ STATIC size_t INIT ZSTD_getcBlockSize(const void *src, size_t srcSize, blockProp
 	}
 }
 
-static size_t INIT ZSTD_copyRawBlock(void *dst, size_t dstCapacity, const void *src, size_t srcSize)
+static size_t __init ZSTD_copyRawBlock(void *dst, size_t dstCapacity, const void *src, size_t srcSize)
 {
 	if (srcSize > dstCapacity)
 		return ERROR(dstSize_tooSmall);
@@ -427,7 +427,7 @@ static size_t INIT ZSTD_copyRawBlock(void *dst, size_t dstCapacity, const void *
 	return srcSize;
 }
 
-static size_t INIT ZSTD_setRleBlock(void *dst, size_t dstCapacity, const void *src, size_t srcSize, size_t regenSize)
+static size_t __init ZSTD_setRleBlock(void *dst, size_t dstCapacity, const void *src, size_t srcSize, size_t regenSize)
 {
 	if (srcSize != 1)
 		return ERROR(srcSize_wrong);
@@ -439,7 +439,7 @@ static size_t INIT ZSTD_setRleBlock(void *dst, size_t dstCapacity, const void *s
 
 /*! ZSTD_decodeLiteralsBlock() :
 	@return : nb of bytes read from src (< srcSize ) */
-STATIC size_t INIT ZSTD_decodeLiteralsBlock(ZSTD_DCtx *dctx, const void *src, size_t srcSize) /* note : srcSize < BLOCKSIZE */
+static size_t __init ZSTD_decodeLiteralsBlock(ZSTD_DCtx *dctx, const void *src, size_t srcSize) /* note : srcSize < BLOCKSIZE */
 {
 	if (srcSize < MIN_CBLOCK_SIZE)
 		return ERROR(corruption_detected);
@@ -759,10 +759,10 @@ static const FSE_decode_t4 OF_defaultDTable[(1 << OF_DEFAULTNORMLOG) + 1] = {
 	@return : nb bytes read from src,
 			  or an error code if it fails, testable with ZSTD_isError()
 */
-static size_t INIT ZSTD_buildSeqTable(FSE_DTable *DTableSpace, const FSE_DTable **DTablePtr,
-				      symbolEncodingType_e type, U32 max, U32 maxLog, const void *src,
-				      size_t srcSize, const FSE_decode_t4 *defaultTable,
-				      U32 flagRepeatTable, void *workspace, size_t workspaceSize)
+static size_t __init ZSTD_buildSeqTable(FSE_DTable *DTableSpace, const FSE_DTable **DTablePtr,
+					symbolEncodingType_e type, U32 max, U32 maxLog, const void *src,
+					size_t srcSize, const FSE_decode_t4 *defaultTable,
+					U32 flagRepeatTable, void *workspace, size_t workspaceSize)
 {
 	const void *const tmpPtr = defaultTable; /* bypass strict aliasing */
 	switch (type) {
@@ -803,7 +803,7 @@ static size_t INIT ZSTD_buildSeqTable(FSE_DTable *DTableSpace, const FSE_DTable
 	}
 }
 
-STATIC size_t INIT ZSTD_decodeSeqHeaders(ZSTD_DCtx *dctx, int *nbSeqPtr, const void *src, size_t srcSize)
+static size_t __init ZSTD_decodeSeqHeaders(ZSTD_DCtx *dctx, int *nbSeqPtr, const void *src, size_t srcSize)
 {
 	const BYTE *const istart = (const BYTE *const)src;
 	const BYTE *const iend = istart + srcSize;
@@ -940,7 +940,7 @@ size_t ZSTD_execSequenceLast7(BYTE *op, BYTE *const oend, seq_t sequence, const
 	return sequenceLength;
 }
 
-static seq_t INIT ZSTD_decodeSequence(seqState_t *seqState)
+static seq_t __init ZSTD_decodeSequence(seqState_t *seqState)
 {
 	seq_t seq;
 
@@ -1102,7 +1102,7 @@ size_t ZSTD_execSequence(BYTE *op, BYTE *const oend, seq_t sequence, const BYTE
 	return sequenceLength;
 }
 
-static size_t INIT ZSTD_decompressSequences(ZSTD_DCtx *dctx, void *dst, size_t maxDstSize, const void *seqStart, size_t seqSize)
+static size_t __init ZSTD_decompressSequences(ZSTD_DCtx *dctx, void *dst, size_t maxDstSize, const void *seqStart, size_t seqSize)
 {
 	const BYTE *ip = (const BYTE *)seqStart;
 	const BYTE *const iend = ip + seqSize;
@@ -1262,7 +1262,7 @@ FORCE_INLINE seq_t ZSTD_decodeSequenceLong_generic(seqState_t *seqState, int con
 	return seq;
 }
 
-static seq_t INIT ZSTD_decodeSequenceLong(seqState_t *seqState, unsigned const windowSize)
+static seq_t __init ZSTD_decodeSequenceLong(seqState_t *seqState, unsigned const windowSize)
 {
 	if (ZSTD_highbit32(windowSize) > STREAM_ACCUMULATOR_MIN) {
 		return ZSTD_decodeSequenceLong_generic(seqState, 1);
@@ -1272,9 +1272,9 @@ static seq_t INIT ZSTD_decodeSequenceLong(seqState_t *seqState, unsigned const w
 }
 
 FORCE_INLINE
-size_t INIT ZSTD_execSequenceLong(BYTE *op, BYTE *const oend, seq_t sequence, const BYTE **litPtr,
-				  const BYTE *const litLimit, const BYTE *const base,
-				  const BYTE *const vBase, const BYTE *const dictEnd)
+size_t __init ZSTD_execSequenceLong(BYTE *op, BYTE *const oend, seq_t sequence, const BYTE **litPtr,
+				    const BYTE *const litLimit, const BYTE *const base,
+				    const BYTE *const vBase, const BYTE *const dictEnd)
 {
 	BYTE *const oLitEnd = op + sequence.litLength;
 	size_t const sequenceLength = sequence.litLength + sequence.matchLength;
@@ -1358,7 +1358,7 @@ size_t INIT ZSTD_execSequenceLong(BYTE *op, BYTE *const oend, seq_t sequence, co
 	return sequenceLength;
 }
 
-static size_t INIT ZSTD_decompressSequencesLong(ZSTD_DCtx *dctx, void *dst, size_t maxDstSize, const void *seqStart, size_t seqSize)
+static size_t __init ZSTD_decompressSequencesLong(ZSTD_DCtx *dctx, void *dst, size_t maxDstSize, const void *seqStart, size_t seqSize)
 {
 	const BYTE *ip = (const BYTE *)seqStart;
 	const BYTE *const iend = ip + seqSize;
@@ -1455,7 +1455,7 @@ static size_t INIT ZSTD_decompressSequencesLong(ZSTD_DCtx *dctx, void *dst, size
 	return op - ostart;
 }
 
-static size_t INIT ZSTD_decompressBlock_internal(ZSTD_DCtx *dctx, void *dst, size_t dstCapacity, const void *src, size_t srcSize)
+static size_t __init ZSTD_decompressBlock_internal(ZSTD_DCtx *dctx, void *dst, size_t dstCapacity, const void *src, size_t srcSize)
 { /* blockType == blockCompressed */
 	const BYTE *ip = (const BYTE *)src;
 
@@ -1479,7 +1479,7 @@ static size_t INIT ZSTD_decompressBlock_internal(ZSTD_DCtx *dctx, void *dst, siz
 	return ZSTD_decompressSequences(dctx, dst, dstCapacity, ip, srcSize);
 }
 
-static void INIT ZSTD_checkContinuity(ZSTD_DCtx *dctx, const void *dst)
+static void __init ZSTD_checkContinuity(ZSTD_DCtx *dctx, const void *dst)
 {
 	if (dst != dctx->previousDstEnd) { /* not contiguous */
 		dctx->dictEnd = dctx->previousDstEnd;
@@ -1490,7 +1490,7 @@ static void INIT ZSTD_checkContinuity(ZSTD_DCtx *dctx, const void *dst)
 }
 
 #ifdef BUILD_DEAD_CODE
-size_t INIT ZSTD_decompressBlock(ZSTD_DCtx *dctx, void *dst, size_t dstCapacity, const void *src, size_t srcSize)
+size_t __init ZSTD_decompressBlock(ZSTD_DCtx *dctx, void *dst, size_t dstCapacity, const void *src, size_t srcSize)
 {
 	size_t dSize;
 	ZSTD_checkContinuity(dctx, dst);
@@ -1501,7 +1501,7 @@ size_t INIT ZSTD_decompressBlock(ZSTD_DCtx *dctx, void *dst, size_t dstCapacity,
 
 /** ZSTD_insertBlock() :
 	insert `src` block into `dctx` history. Useful to track uncompressed blocks. */
-size_t INIT ZSTD_insertBlock(ZSTD_DCtx *dctx, const void *blockStart, size_t blockSize)
+size_t __init ZSTD_insertBlock(ZSTD_DCtx *dctx, const void *blockStart, size_t blockSize)
 {
 	ZSTD_checkContinuity(dctx, blockStart);
 	dctx->previousDstEnd = (const char *)blockStart + blockSize;
@@ -1509,7 +1509,7 @@ size_t INIT ZSTD_insertBlock(ZSTD_DCtx *dctx, const void *blockStart, size_t blo
 }
 #endif /* BUILD_DEAD_CODE */
 
-STATIC size_t INIT ZSTD_generateNxBytes(void *dst, size_t dstCapacity, BYTE byte, size_t length)
+static size_t __init ZSTD_generateNxBytes(void *dst, size_t dstCapacity, BYTE byte, size_t length)
 {
 	if (length > dstCapacity)
 		return ERROR(dstSize_tooSmall);
@@ -1522,7 +1522,7 @@ STATIC size_t INIT ZSTD_generateNxBytes(void *dst, size_t dstCapacity, BYTE byte
  *  `src` must point to the start of a ZSTD frame, ZSTD legacy frame, or skippable frame
  *  `srcSize` must be at least as large as the frame contained
  *  @return : the compressed size of the frame starting at `src` */
-STATIC size_t INIT ZSTD_findFrameCompressedSize(const void *src, size_t srcSize)
+static size_t __init ZSTD_findFrameCompressedSize(const void *src, size_t srcSize)
 {
 	if (srcSize >= ZSTD_skippableHeaderSize && (ZSTD_readLE32(src) & 0xFFFFFFF0U) == ZSTD_MAGIC_SKIPPABLE_START) {
 		return ZSTD_skippableHeaderSize + ZSTD_readLE32((const BYTE *)src + 4);
@@ -1578,7 +1578,7 @@ STATIC size_t INIT ZSTD_findFrameCompressedSize(const void *src, size_t srcSize)
 
 /*! ZSTD_decompressFrame() :
 *   @dctx must be properly initialized */
-static size_t INIT ZSTD_decompressFrame(ZSTD_DCtx *dctx, void *dst, size_t dstCapacity, const void **srcPtr, size_t *srcSizePtr)
+static size_t __init ZSTD_decompressFrame(ZSTD_DCtx *dctx, void *dst, size_t dstCapacity, const void **srcPtr, size_t *srcSizePtr)
 {
 	const BYTE *ip = (const BYTE *)(*srcPtr);
 	BYTE *const ostart = (BYTE * const)dst;
@@ -1655,7 +1655,7 @@ static size_t INIT ZSTD_decompressFrame(ZSTD_DCtx *dctx, void *dst, size_t dstCa
 static const void *ZSTD_DDictDictContent(const ZSTD_DDict *ddict);
 static size_t ZSTD_DDictDictSize(const ZSTD_DDict *ddict);
 
-static size_t INIT ZSTD_decompressMultiFrame(ZSTD_DCtx *dctx, void *dst, size_t dstCapacity, const void *src, size_t srcSize, const void *dict, size_t dictSize,
+static size_t __init ZSTD_decompressMultiFrame(ZSTD_DCtx *dctx, void *dst, size_t dstCapacity, const void *src, size_t srcSize, const void *dict, size_t dictSize,
 					const ZSTD_DDict *ddict)
 {
 	void *const dststart = dst;
@@ -1719,12 +1719,12 @@ static size_t INIT ZSTD_decompressMultiFrame(ZSTD_DCtx *dctx, void *dst, size_t
 	return (BYTE *)dst - (BYTE *)dststart;
 }
 
-STATIC size_t INIT ZSTD_decompress_usingDict(ZSTD_DCtx *dctx, void *dst, size_t dstCapacity, const void *src, size_t srcSize, const void *dict, size_t dictSize)
+static size_t __init ZSTD_decompress_usingDict(ZSTD_DCtx *dctx, void *dst, size_t dstCapacity, const void *src, size_t srcSize, const void *dict, size_t dictSize)
 {
 	return ZSTD_decompressMultiFrame(dctx, dst, dstCapacity, src, srcSize, dict, dictSize, NULL);
 }
 
-STATIC size_t INIT ZSTD_decompressDCtx(ZSTD_DCtx *dctx, void *dst, size_t dstCapacity, const void *src, size_t srcSize)
+static size_t __init ZSTD_decompressDCtx(ZSTD_DCtx *dctx, void *dst, size_t dstCapacity, const void *src, size_t srcSize)
 {
 	return ZSTD_decompress_usingDict(dctx, dst, dstCapacity, src, srcSize, NULL, 0);
 }
@@ -1733,12 +1733,12 @@ STATIC size_t INIT ZSTD_decompressDCtx(ZSTD_DCtx *dctx, void *dst, size_t dstCap
 *   Advanced Streaming Decompression API
 *   Bufferless and synchronous
 ****************************************/
-STATIC size_t INIT ZSTD_nextSrcSizeToDecompress(ZSTD_DCtx *dctx)
+static size_t __init ZSTD_nextSrcSizeToDecompress(ZSTD_DCtx *dctx)
 {
 	return dctx->expected;
 }
 
-STATIC ZSTD_nextInputType_e INIT ZSTD_nextInputType(ZSTD_DCtx *dctx)
+static ZSTD_nextInputType_e __init ZSTD_nextInputType(ZSTD_DCtx *dctx)
 {
 	switch (dctx->stage) {
 	default: /* should not happen */
@@ -1753,12 +1753,12 @@ STATIC ZSTD_nextInputType_e INIT ZSTD_nextInputType(ZSTD_DCtx *dctx)
 	}
 }
 
-int INIT ZSTD_isSkipFrame(ZSTD_DCtx *dctx) { return dctx->stage == ZSTDds_skipFrame; } /* for zbuff */
+int __init ZSTD_isSkipFrame(ZSTD_DCtx *dctx) { return dctx->stage == ZSTDds_skipFrame; } /* for zbuff */
 
 /** ZSTD_decompressContinue() :
 *   @return : nb of bytes generated into `dst` (necessarily <= `dstCapacity)
 *             or an error code, which can be tested using ZSTD_isError() */
-STATIC size_t INIT ZSTD_decompressContinue(ZSTD_DCtx *dctx, void *dst, size_t dstCapacity, const void *src, size_t srcSize)
+static size_t __init ZSTD_decompressContinue(ZSTD_DCtx *dctx, void *dst, size_t dstCapacity, const void *src, size_t srcSize)
 {
 	/* Sanity check */
 	if (srcSize != dctx->expected)
@@ -1877,7 +1877,7 @@ STATIC size_t INIT ZSTD_decompressContinue(ZSTD_DCtx *dctx, void *dst, size_t ds
 	}
 }
 
-static size_t INIT ZSTD_refDictContent(ZSTD_DCtx *dctx, const void *dict, size_t dictSize)
+static size_t __init ZSTD_refDictContent(ZSTD_DCtx *dctx, const void *dict, size_t dictSize)
 {
 	dctx->dictEnd = dctx->previousDstEnd;
 	dctx->vBase = (const char *)dict - ((const char *)(dctx->previousDstEnd) - (const char *)(dctx->base));
@@ -1889,7 +1889,7 @@ static size_t INIT ZSTD_refDictContent(ZSTD_DCtx *dctx, const void *dict, size_t
 /* ZSTD_loadEntropy() :
  * dict : must point at beginning of a valid zstd dictionary
  * @return : size of entropy tables read */
-static size_t INIT ZSTD_loadEntropy(ZSTD_entropyTables_t *entropy, const void *const dict, size_t const dictSize)
+static size_t __init ZSTD_loadEntropy(ZSTD_entropyTables_t *entropy, const void *const dict, size_t const dictSize)
 {
 	const BYTE *dictPtr = (const BYTE *)dict;
 	const BYTE *const dictEnd = dictPtr + dictSize;
@@ -1958,7 +1958,7 @@ static size_t INIT ZSTD_loadEntropy(ZSTD_entropyTables_t *entropy, const void *c
 	return dictPtr - (const BYTE *)dict;
 }
 
-static size_t INIT ZSTD_decompress_insertDictionary(ZSTD_DCtx *dctx, const void *dict, size_t dictSize)
+static size_t __init ZSTD_decompress_insertDictionary(ZSTD_DCtx *dctx, const void *dict, size_t dictSize)
 {
 	if (dictSize < 8)
 		return ZSTD_refDictContent(dctx, dict, dictSize);
@@ -1984,7 +1984,7 @@ static size_t INIT ZSTD_decompress_insertDictionary(ZSTD_DCtx *dctx, const void
 	return ZSTD_refDictContent(dctx, dict, dictSize);
 }
 
-STATIC size_t INIT ZSTD_decompressBegin_usingDict(ZSTD_DCtx *dctx, const void *dict, size_t dictSize)
+static size_t __init ZSTD_decompressBegin_usingDict(ZSTD_DCtx *dctx, const void *dict, size_t dictSize)
 {
 	CHECK_F(ZSTD_decompressBegin(dctx));
 	if (dict && dictSize)
@@ -2005,14 +2005,14 @@ struct ZSTD_DDict_s {
 }; /* typedef'd to ZSTD_DDict within "zstd.h" */
 
 #ifdef BUILD_DEAD_CODE
-size_t INIT ZSTD_DDictWorkspaceBound(void) { return ZSTD_ALIGN(sizeof(ZSTD_stack)) + ZSTD_ALIGN(sizeof(ZSTD_DDict)); }
+size_t __init ZSTD_DDictWorkspaceBound(void) { return ZSTD_ALIGN(sizeof(ZSTD_stack)) + ZSTD_ALIGN(sizeof(ZSTD_DDict)); }
 #endif
 
-static const void *INIT ZSTD_DDictDictContent(const ZSTD_DDict *ddict) { return ddict->dictContent; }
+static const void *__init ZSTD_DDictDictContent(const ZSTD_DDict *ddict) { return ddict->dictContent; }
 
-static size_t INIT ZSTD_DDictDictSize(const ZSTD_DDict *ddict) { return ddict->dictSize; }
+static size_t __init ZSTD_DDictDictSize(const ZSTD_DDict *ddict) { return ddict->dictSize; }
 
-static void INIT ZSTD_refDDict(ZSTD_DCtx *dstDCtx, const ZSTD_DDict *ddict)
+static void __init ZSTD_refDDict(ZSTD_DCtx *dstDCtx, const ZSTD_DDict *ddict)
 {
 	ZSTD_decompressBegin(dstDCtx); /* init */
 	if (ddict) {		       /* support refDDict on NULL */
@@ -2039,7 +2039,7 @@ static void INIT ZSTD_refDDict(ZSTD_DCtx *dstDCtx, const ZSTD_DDict *ddict)
 }
 
 #ifdef BUILD_DEAD_CODE
-static size_t INIT ZSTD_loadEntropy_inDDict(ZSTD_DDict *ddict)
+static size_t __init ZSTD_loadEntropy_inDDict(ZSTD_DDict *ddict)
 {
 	ddict->dictID = 0;
 	ddict->entropyPresent = 0;
@@ -2058,7 +2058,7 @@ static size_t INIT ZSTD_loadEntropy_inDDict(ZSTD_DDict *ddict)
 	return 0;
 }
 
-static ZSTD_DDict *INIT ZSTD_createDDict_advanced(const void *dict, size_t dictSize, unsigned byReference, ZSTD_customMem customMem)
+static ZSTD_DDict *__init ZSTD_createDDict_advanced(const void *dict, size_t dictSize, unsigned byReference, ZSTD_customMem customMem)
 {
 	if (!customMem.customAlloc || !customMem.customFree)
 		return NULL;
@@ -2101,14 +2101,14 @@ static ZSTD_DDict *INIT ZSTD_createDDict_advanced(const void *dict, size_t dictS
 *   Create a digested dictionary, to start decompression without startup delay.
 *   `dict` content is copied inside DDict.
 *   Consequently, `dict` can be released after `ZSTD_DDict` creation */
-ZSTD_DDict *INIT ZSTD_initDDict(const void *dict, size_t dictSize, void *workspace, size_t workspaceSize)
+ZSTD_DDict *__init ZSTD_initDDict(const void *dict, size_t dictSize, void *workspace, size_t workspaceSize)
 {
 	ZSTD_customMem const stackMem = ZSTD_initStack(workspace, workspaceSize);
 	return ZSTD_createDDict_advanced(dict, dictSize, 1, stackMem);
 }
 #endif /* BUILD_DEAD_CODE */
 
-size_t INIT ZSTD_freeDDict(ZSTD_DDict *ddict)
+size_t __init ZSTD_freeDDict(ZSTD_DDict *ddict)
 {
 	if (ddict == NULL)
 		return 0; /* support free on NULL */
@@ -2125,7 +2125,7 @@ size_t INIT ZSTD_freeDDict(ZSTD_DDict *ddict)
  *  Provides the dictID stored within dictionary.
  *  if @return == 0, the dictionary is not conformant with Zstandard specification.
  *  It can still be loaded, but as a content-only dictionary. */
-unsigned INIT ZSTD_getDictID_fromDict(const void *dict, size_t dictSize)
+unsigned __init ZSTD_getDictID_fromDict(const void *dict, size_t dictSize)
 {
 	if (dictSize < 8)
 		return 0;
@@ -2138,7 +2138,7 @@ unsigned INIT ZSTD_getDictID_fromDict(const void *dict, size_t dictSize)
  *  Provides the dictID of the dictionary loaded into `ddict`.
  *  If @return == 0, the dictionary is not conformant to Zstandard specification, or empty.
  *  Non-conformant dictionaries can still be loaded, but as content-only dictionaries. */
-unsigned INIT ZSTD_getDictID_fromDDict(const ZSTD_DDict *ddict)
+unsigned __init ZSTD_getDictID_fromDDict(const ZSTD_DDict *ddict)
 {
 	if (ddict == NULL)
 		return 0;
@@ -2155,7 +2155,7 @@ unsigned INIT ZSTD_getDictID_fromDDict(const ZSTD_DDict *ddict)
  *  - `srcSize` is too small, and as a result, the frame header could not be decoded (only possible if `srcSize < ZSTD_FRAMEHEADERSIZE_MAX`).
  *  - This is not a Zstandard frame.
  *  When identifying the exact failure cause, it's possible to used ZSTD_getFrameParams(), which will provide a more precise error code. */
-unsigned INIT ZSTD_getDictID_fromFrame(const void *src, size_t srcSize)
+unsigned __init ZSTD_getDictID_fromFrame(const void *src, size_t srcSize)
 {
 	ZSTD_frameParams zfp = {0, 0, 0, 0};
 	size_t const hError = ZSTD_getFrameParams(&zfp, src, srcSize);
@@ -2168,7 +2168,7 @@ unsigned INIT ZSTD_getDictID_fromFrame(const void *src, size_t srcSize)
 /*! ZSTD_decompress_usingDDict() :
 *   Decompression using a pre-digested Dictionary
 *   Use dictionary without significant overhead. */
-STATIC size_t INIT ZSTD_decompress_usingDDict(ZSTD_DCtx *dctx, void *dst, size_t dstCapacity, const void *src, size_t srcSize, const ZSTD_DDict *ddict)
+static size_t __init ZSTD_decompress_usingDDict(ZSTD_DCtx *dctx, void *dst, size_t dstCapacity, const void *src, size_t srcSize, const ZSTD_DDict *ddict)
 {
 	/* pass content and size in case legacy frames are encountered */
 	return ZSTD_decompressMultiFrame(dctx, dst, dstCapacity, src, srcSize, NULL, 0, ddict);
@@ -2205,7 +2205,7 @@ struct ZSTD_DStream_s {
 	U32 hostageByte;
 }; /* typedef'd to ZSTD_DStream within "zstd.h" */
 
-STATIC size_t INIT ZSTD_DStreamWorkspaceBound(size_t maxWindowSize)
+static size_t __init ZSTD_DStreamWorkspaceBound(size_t maxWindowSize)
 {
 	size_t const blockSize = MIN(maxWindowSize, ZSTD_BLOCKSIZE_ABSOLUTEMAX);
 	size_t const inBuffSize = blockSize;
@@ -2213,7 +2213,7 @@ STATIC size_t INIT ZSTD_DStreamWorkspaceBound(size_t maxWindowSize)
 	return ZSTD_DCtxWorkspaceBound() + ZSTD_ALIGN(sizeof(ZSTD_DStream)) + ZSTD_ALIGN(inBuffSize) + ZSTD_ALIGN(outBuffSize);
 }
 
-static ZSTD_DStream *INIT ZSTD_createDStream_advanced(ZSTD_customMem customMem)
+static ZSTD_DStream *__init ZSTD_createDStream_advanced(ZSTD_customMem customMem)
 {
 	ZSTD_DStream *zds;
 
@@ -2235,7 +2235,7 @@ static ZSTD_DStream *INIT ZSTD_createDStream_advanced(ZSTD_customMem customMem)
 	return zds;
 }
 
-STATIC ZSTD_DStream *INIT ZSTD_initDStream(size_t maxWindowSize, void *workspace, size_t workspaceSize)
+static ZSTD_DStream *__init ZSTD_initDStream(size_t maxWindowSize, void *workspace, size_t workspaceSize)
 {
 	ZSTD_customMem const stackMem = ZSTD_initStack(workspace, workspaceSize);
 	ZSTD_DStream *zds = ZSTD_createDStream_advanced(stackMem);
@@ -2269,7 +2269,7 @@ STATIC ZSTD_DStream *INIT ZSTD_initDStream(size_t maxWindowSize, void *workspace
 }
 
 #ifdef BUILD_DEAD_CODE
-ZSTD_DStream *INIT ZSTD_initDStream_usingDDict(size_t maxWindowSize, const ZSTD_DDict *ddict, void *workspace, size_t workspaceSize)
+ZSTD_DStream *__init ZSTD_initDStream_usingDDict(size_t maxWindowSize, const ZSTD_DDict *ddict, void *workspace, size_t workspaceSize)
 {
 	ZSTD_DStream *zds = ZSTD_initDStream(maxWindowSize, workspace, workspaceSize);
 	if (zds) {
@@ -2279,7 +2279,7 @@ ZSTD_DStream *INIT ZSTD_initDStream_usingDDict(size_t maxWindowSize, const ZSTD_
 }
 #endif
 
-size_t INIT ZSTD_freeDStream(ZSTD_DStream *zds)
+size_t __init ZSTD_freeDStream(ZSTD_DStream *zds)
 {
 	if (zds == NULL)
 		return 0; /* support free on null */
@@ -2301,11 +2301,11 @@ size_t INIT ZSTD_freeDStream(ZSTD_DStream *zds)
 /* *** Initialization *** */
 
 #ifdef BUILD_DEAD_CODE
-size_t INIT ZSTD_DStreamInSize(void) { return ZSTD_BLOCKSIZE_ABSOLUTEMAX + ZSTD_blockHeaderSize; }
-size_t INIT ZSTD_DStreamOutSize(void) { return ZSTD_BLOCKSIZE_ABSOLUTEMAX; }
+size_t __init ZSTD_DStreamInSize(void) { return ZSTD_BLOCKSIZE_ABSOLUTEMAX + ZSTD_blockHeaderSize; }
+size_t __init ZSTD_DStreamOutSize(void) { return ZSTD_BLOCKSIZE_ABSOLUTEMAX; }
 #endif
 
-STATIC size_t INIT ZSTD_resetDStream(ZSTD_DStream *zds)
+static size_t __init ZSTD_resetDStream(ZSTD_DStream *zds)
 {
 	zds->stage = zdss_loadHeader;
 	zds->lhSize = zds->inPos = zds->outStart = zds->outEnd = 0;
@@ -2316,14 +2316,14 @@ STATIC size_t INIT ZSTD_resetDStream(ZSTD_DStream *zds)
 
 /* *****   Decompression   ***** */
 
-ZSTD_STATIC size_t INIT ZSTD_limitCopy(void *dst, size_t dstCapacity, const void *src, size_t srcSize)
+ZSTD_STATIC size_t __init ZSTD_limitCopy(void *dst, size_t dstCapacity, const void *src, size_t srcSize)
 {
 	size_t const length = MIN(dstCapacity, srcSize);
 	memcpy(dst, src, length);
 	return length;
 }
 
-STATIC size_t INIT ZSTD_decompressStream(ZSTD_DStream *zds, ZSTD_outBuffer *output, ZSTD_inBuffer *input)
+static size_t __init ZSTD_decompressStream(ZSTD_DStream *zds, ZSTD_outBuffer *output, ZSTD_inBuffer *input)
 {
 	const char *const istart = (const char *)(input->src) + input->pos;
 	const char *const iend = (const char *)(input->src) + input->size;
diff --git a/xen/common/zstd/entropy_common.c b/xen/common/zstd/entropy_common.c
index bcdb57982b..d329cccc60 100644
--- a/xen/common/zstd/entropy_common.c
+++ b/xen/common/zstd/entropy_common.c
@@ -46,17 +46,17 @@
 #include "mem.h"
 
 /*===   Version   ===*/
-unsigned INIT FSE_versionNumber(void) { return FSE_VERSION_NUMBER; }
+unsigned __init FSE_versionNumber(void) { return FSE_VERSION_NUMBER; }
 
 /*===   Error Management   ===*/
-unsigned INIT FSE_isError(size_t code) { return ERR_isError(code); }
+unsigned __init FSE_isError(size_t code) { return ERR_isError(code); }
 
-unsigned INIT HUF_isError(size_t code) { return ERR_isError(code); }
+unsigned __init HUF_isError(size_t code) { return ERR_isError(code); }
 
 /*-**************************************************************
 *  FSE NCount encoding-decoding
 ****************************************************************/
-size_t INIT FSE_readNCount(short *normalizedCounter, unsigned *maxSVPtr, unsigned *tableLogPtr, const void *headerBuffer, size_t hbSize)
+size_t __init FSE_readNCount(short *normalizedCounter, unsigned *maxSVPtr, unsigned *tableLogPtr, const void *headerBuffer, size_t hbSize)
 {
 	const BYTE *const istart = (const BYTE *)headerBuffer;
 	const BYTE *const iend = istart + hbSize;
@@ -164,7 +164,7 @@ size_t INIT FSE_readNCount(short *normalizedCounter, unsigned *maxSVPtr, unsigne
 	@return : size read from `src` , or an error Code .
 	Note : Needed by HUF_readCTable() and HUF_readDTableX?() .
 */
-size_t INIT HUF_readStats_wksp(BYTE *huffWeight, size_t hwSize, U32 *rankStats, U32 *nbSymbolsPtr, U32 *tableLogPtr, const void *src, size_t srcSize, void *workspace, size_t workspaceSize)
+size_t __init HUF_readStats_wksp(BYTE *huffWeight, size_t hwSize, U32 *rankStats, U32 *nbSymbolsPtr, U32 *tableLogPtr, const void *src, size_t srcSize, void *workspace, size_t workspaceSize)
 {
 	U32 weightTotal;
 	const BYTE *ip = (const BYTE *)src;
diff --git a/xen/common/zstd/error_private.h b/xen/common/zstd/error_private.h
index 906d537e08..fa84ae4fef 100644
--- a/xen/common/zstd/error_private.h
+++ b/xen/common/zstd/error_private.h
@@ -67,9 +67,9 @@ typedef ZSTD_ErrorCode ERR_enum;
 ******************************************/
 #define ERROR(name) ((size_t)-PREFIX(name))
 
-ERR_STATIC unsigned INIT ERR_isError(size_t code) { return (code > ERROR(maxCode)); }
+ERR_STATIC unsigned __init ERR_isError(size_t code) { return (code > ERROR(maxCode)); }
 
-ERR_STATIC ERR_enum INIT ERR_getErrorCode(size_t code)
+ERR_STATIC ERR_enum __init ERR_getErrorCode(size_t code)
 {
 	if (!ERR_isError(code))
 		return (ERR_enum)0;
@@ -82,7 +82,7 @@ ERR_STATIC ERR_enum INIT ERR_getErrorCode(size_t code)
  *
  * Return: Non-zero iff the code is an error.
  */
-static __attribute__((unused)) unsigned int INIT ZSTD_isError(size_t code)
+static __attribute__((unused)) unsigned int __init ZSTD_isError(size_t code)
 {
 	return code > (size_t)-ZSTD_error_maxCode;
 }
@@ -94,7 +94,7 @@ static __attribute__((unused)) unsigned int INIT ZSTD_isError(size_t code)
  * Return:          The ZSTD_ErrorCode corresponding to the functionResult or 0
  *                  if the functionResult isn't an error.
  */
-static __attribute__((unused)) ZSTD_ErrorCode INIT ZSTD_getErrorCode(
+static __attribute__((unused)) ZSTD_ErrorCode __init ZSTD_getErrorCode(
 	size_t functionResult)
 {
 	if (!ZSTD_isError(functionResult))
diff --git a/xen/common/zstd/fse_decompress.c b/xen/common/zstd/fse_decompress.c
index 6c61e9002e..ba5f960eb3 100644
--- a/xen/common/zstd/fse_decompress.c
+++ b/xen/common/zstd/fse_decompress.c
@@ -82,7 +82,7 @@
 
 /* Function templates */
 
-size_t INIT FSE_buildDTable_wksp(FSE_DTable *dt, const short *normalizedCounter, unsigned maxSymbolValue, unsigned tableLog, void *workspace, size_t workspaceSize)
+size_t __init FSE_buildDTable_wksp(FSE_DTable *dt, const short *normalizedCounter, unsigned maxSymbolValue, unsigned tableLog, void *workspace, size_t workspaceSize)
 {
 	void *const tdPtr = dt + 1; /* because *dt is unsigned, 32-bits aligned on 32-bits */
 	FSE_DECODE_TYPE *const tableDecode = (FSE_DECODE_TYPE *)(tdPtr);
@@ -157,7 +157,7 @@ size_t INIT FSE_buildDTable_wksp(FSE_DTable *dt, const short *normalizedCounter,
 /*-*******************************************************
 *  Decompression (Byte symbols)
 *********************************************************/
-size_t INIT FSE_buildDTable_rle(FSE_DTable *dt, BYTE symbolValue)
+size_t __init FSE_buildDTable_rle(FSE_DTable *dt, BYTE symbolValue)
 {
 	void *ptr = dt;
 	FSE_DTableHeader *const DTableH = (FSE_DTableHeader *)ptr;
@@ -174,7 +174,7 @@ size_t INIT FSE_buildDTable_rle(FSE_DTable *dt, BYTE symbolValue)
 	return 0;
 }
 
-size_t INIT FSE_buildDTable_raw(FSE_DTable *dt, unsigned nbBits)
+size_t __init FSE_buildDTable_raw(FSE_DTable *dt, unsigned nbBits)
 {
 	void *ptr = dt;
 	FSE_DTableHeader *const DTableH = (FSE_DTableHeader *)ptr;
@@ -269,7 +269,7 @@ FORCE_INLINE size_t FSE_decompress_usingDTable_generic(void *dst, size_t maxDstS
 	return op - ostart;
 }
 
-size_t INIT FSE_decompress_usingDTable(void *dst, size_t originalSize, const void *cSrc, size_t cSrcSize, const FSE_DTable *dt)
+size_t __init FSE_decompress_usingDTable(void *dst, size_t originalSize, const void *cSrc, size_t cSrcSize, const FSE_DTable *dt)
 {
 	const void *ptr = dt;
 	const FSE_DTableHeader *DTableH = (const FSE_DTableHeader *)ptr;
@@ -281,7 +281,7 @@ size_t INIT FSE_decompress_usingDTable(void *dst, size_t originalSize, const voi
 	return FSE_decompress_usingDTable_generic(dst, originalSize, cSrc, cSrcSize, dt, 0);
 }
 
-size_t INIT FSE_decompress_wksp(void *dst, size_t dstCapacity, const void *cSrc, size_t cSrcSize, unsigned maxLog, void *workspace, size_t workspaceSize)
+size_t __init FSE_decompress_wksp(void *dst, size_t dstCapacity, const void *cSrc, size_t cSrcSize, unsigned maxLog, void *workspace, size_t workspaceSize)
 {
 	const BYTE *const istart = (const BYTE *)cSrc;
 	const BYTE *ip = istart;
diff --git a/xen/common/zstd/huf_decompress.c b/xen/common/zstd/huf_decompress.c
index f6aca709a6..1bdfc695d0 100644
--- a/xen/common/zstd/huf_decompress.c
+++ b/xen/common/zstd/huf_decompress.c
@@ -68,7 +68,7 @@ typedef struct {
 	BYTE reserved;
 } DTableDesc;
 
-static DTableDesc INIT HUF_getDTableDesc(const HUF_DTable *table)
+static DTableDesc __init HUF_getDTableDesc(const HUF_DTable *table)
 {
 	DTableDesc dtd;
 	memcpy(&dtd, table, sizeof(dtd));
@@ -84,7 +84,7 @@ typedef struct {
 	BYTE nbBits;
 } HUF_DEltX2; /* single-symbol decoding */
 
-size_t INIT HUF_readDTableX2_wksp(HUF_DTable *DTable, const void *src, size_t srcSize, void *workspace, size_t workspaceSize)
+size_t __init HUF_readDTableX2_wksp(HUF_DTable *DTable, const void *src, size_t srcSize, void *workspace, size_t workspaceSize)
 {
 	U32 tableLog = 0;
 	U32 nbSymbols = 0;
@@ -152,7 +152,7 @@ size_t INIT HUF_readDTableX2_wksp(HUF_DTable *DTable, const void *src, size_t sr
 	return iSize;
 }
 
-static BYTE INIT HUF_decodeSymbolX2(BIT_DStream_t *Dstream, const HUF_DEltX2 *dt, const U32 dtLog)
+static BYTE __init HUF_decodeSymbolX2(BIT_DStream_t *Dstream, const HUF_DEltX2 *dt, const U32 dtLog)
 {
 	size_t const val = BIT_lookBitsFast(Dstream, dtLog); /* note : dtLog >= 1 */
 	BYTE const c = dt[val].byte;
@@ -193,7 +193,7 @@ FORCE_INLINE size_t HUF_decodeStreamX2(BYTE *p, BIT_DStream_t *const bitDPtr, BY
 	return pEnd - pStart;
 }
 
-static size_t INIT HUF_decompress1X2_usingDTable_internal(void *dst, size_t dstSize, const void *cSrc, size_t cSrcSize, const HUF_DTable *DTable)
+static size_t __init HUF_decompress1X2_usingDTable_internal(void *dst, size_t dstSize, const void *cSrc, size_t cSrcSize, const HUF_DTable *DTable)
 {
 	BYTE *op = (BYTE *)dst;
 	BYTE *const oend = op + dstSize;
@@ -218,7 +218,7 @@ static size_t INIT HUF_decompress1X2_usingDTable_internal(void *dst, size_t dstS
 	return dstSize;
 }
 
-size_t INIT HUF_decompress1X2_usingDTable(void *dst, size_t dstSize, const void *cSrc, size_t cSrcSize, const HUF_DTable *DTable)
+size_t __init HUF_decompress1X2_usingDTable(void *dst, size_t dstSize, const void *cSrc, size_t cSrcSize, const HUF_DTable *DTable)
 {
 	DTableDesc dtd = HUF_getDTableDesc(DTable);
 	if (dtd.tableType != 0)
@@ -226,7 +226,7 @@ size_t INIT HUF_decompress1X2_usingDTable(void *dst, size_t dstSize, const void
 	return HUF_decompress1X2_usingDTable_internal(dst, dstSize, cSrc, cSrcSize, DTable);
 }
 
-size_t INIT HUF_decompress1X2_DCtx_wksp(HUF_DTable *DCtx, void *dst, size_t dstSize, const void *cSrc, size_t cSrcSize, void *workspace, size_t workspaceSize)
+size_t __init HUF_decompress1X2_DCtx_wksp(HUF_DTable *DCtx, void *dst, size_t dstSize, const void *cSrc, size_t cSrcSize, void *workspace, size_t workspaceSize)
 {
 	const BYTE *ip = (const BYTE *)cSrc;
 
@@ -241,7 +241,7 @@ size_t INIT HUF_decompress1X2_DCtx_wksp(HUF_DTable *DCtx, void *dst, size_t dstS
 	return HUF_decompress1X2_usingDTable_internal(dst, dstSize, ip, cSrcSize, DCtx);
 }
 
-static size_t INIT HUF_decompress4X2_usingDTable_internal(void *dst, size_t dstSize, const void *cSrc, size_t cSrcSize, const HUF_DTable *DTable)
+static size_t __init HUF_decompress4X2_usingDTable_internal(void *dst, size_t dstSize, const void *cSrc, size_t cSrcSize, const HUF_DTable *DTable)
 {
 	/* Check */
 	if (cSrcSize < 10)
@@ -349,7 +349,7 @@ static size_t INIT HUF_decompress4X2_usingDTable_internal(void *dst, size_t dstS
 	}
 }
 
-size_t INIT HUF_decompress4X2_usingDTable(void *dst, size_t dstSize, const void *cSrc, size_t cSrcSize, const HUF_DTable *DTable)
+size_t __init HUF_decompress4X2_usingDTable(void *dst, size_t dstSize, const void *cSrc, size_t cSrcSize, const HUF_DTable *DTable)
 {
 	DTableDesc dtd = HUF_getDTableDesc(DTable);
 	if (dtd.tableType != 0)
@@ -357,7 +357,7 @@ size_t INIT HUF_decompress4X2_usingDTable(void *dst, size_t dstSize, const void
 	return HUF_decompress4X2_usingDTable_internal(dst, dstSize, cSrc, cSrcSize, DTable);
 }
 
-size_t INIT HUF_decompress4X2_DCtx_wksp(HUF_DTable *dctx, void *dst, size_t dstSize, const void *cSrc, size_t cSrcSize, void *workspace, size_t workspaceSize)
+size_t __init HUF_decompress4X2_DCtx_wksp(HUF_DTable *dctx, void *dst, size_t dstSize, const void *cSrc, size_t cSrcSize, void *workspace, size_t workspaceSize)
 {
 	const BYTE *ip = (const BYTE *)cSrc;
 
@@ -388,7 +388,7 @@ typedef struct {
 
 /* HUF_fillDTableX4Level2() :
  * `rankValOrigin` must be a table of at least (HUF_TABLELOG_MAX + 1) U32 */
-static void INIT HUF_fillDTableX4Level2(HUF_DEltX4 *DTable, U32 sizeLog, const U32 consumed, const U32 *rankValOrigin, const int minWeight,
+static void __init HUF_fillDTableX4Level2(HUF_DEltX4 *DTable, U32 sizeLog, const U32 consumed, const U32 *rankValOrigin, const int minWeight,
 					const sortedSymbol_t *sortedSymbols, const U32 sortedListSize, U32 nbBitsBaseline, U16 baseSeq)
 {
 	HUF_DEltX4 DElt;
@@ -434,7 +434,7 @@ static void INIT HUF_fillDTableX4Level2(HUF_DEltX4 *DTable, U32 sizeLog, const U
 typedef U32 rankVal_t[HUF_TABLELOG_MAX][HUF_TABLELOG_MAX + 1];
 typedef U32 rankValCol_t[HUF_TABLELOG_MAX + 1];
 
-static void INIT HUF_fillDTableX4(HUF_DEltX4 *DTable, const U32 targetLog, const sortedSymbol_t *sortedList,
+static void __init HUF_fillDTableX4(HUF_DEltX4 *DTable, const U32 targetLog, const sortedSymbol_t *sortedList,
 				  const U32 sortedListSize, const U32 *rankStart,
 			          rankVal_t rankValOrigin, const U32 maxWeight, const U32 nbBitsBaseline)
 {
@@ -477,7 +477,7 @@ static void INIT HUF_fillDTableX4(HUF_DEltX4 *DTable, const U32 targetLog, const
 	}
 }
 
-size_t INIT HUF_readDTableX4_wksp(HUF_DTable *DTable, const void *src, size_t srcSize, void *workspace, size_t workspaceSize)
+size_t __init HUF_readDTableX4_wksp(HUF_DTable *DTable, const void *src, size_t srcSize, void *workspace, size_t workspaceSize)
 {
 	U32 tableLog, maxW, sizeOfSort, nbSymbols;
 	DTableDesc dtd = HUF_getDTableDesc(DTable);
@@ -590,7 +590,7 @@ size_t INIT HUF_readDTableX4_wksp(HUF_DTable *DTable, const void *src, size_t sr
 	return iSize;
 }
 
-static U32 INIT HUF_decodeSymbolX4(void *op, BIT_DStream_t *DStream, const HUF_DEltX4 *dt, const U32 dtLog)
+static U32 __init HUF_decodeSymbolX4(void *op, BIT_DStream_t *DStream, const HUF_DEltX4 *dt, const U32 dtLog)
 {
 	size_t const val = BIT_lookBitsFast(DStream, dtLog); /* note : dtLog >= 1 */
 	memcpy(op, dt + val, 2);
@@ -598,7 +598,7 @@ static U32 INIT HUF_decodeSymbolX4(void *op, BIT_DStream_t *DStream, const HUF_D
 	return dt[val].length;
 }
 
-static U32 INIT HUF_decodeLastSymbolX4(void *op, BIT_DStream_t *DStream, const HUF_DEltX4 *dt, const U32 dtLog)
+static U32 __init HUF_decodeLastSymbolX4(void *op, BIT_DStream_t *DStream, const HUF_DEltX4 *dt, const U32 dtLog)
 {
 	size_t const val = BIT_lookBitsFast(DStream, dtLog); /* note : dtLog >= 1 */
 	memcpy(op, dt + val, 1);
@@ -650,7 +650,7 @@ FORCE_INLINE size_t HUF_decodeStreamX4(BYTE *p, BIT_DStream_t *bitDPtr, BYTE *co
 	return p - pStart;
 }
 
-static size_t INIT HUF_decompress1X4_usingDTable_internal(void *dst, size_t dstSize, const void *cSrc, size_t cSrcSize, const HUF_DTable *DTable)
+static size_t __init HUF_decompress1X4_usingDTable_internal(void *dst, size_t dstSize, const void *cSrc, size_t cSrcSize, const HUF_DTable *DTable)
 {
 	BIT_DStream_t bitD;
 
@@ -679,7 +679,7 @@ static size_t INIT HUF_decompress1X4_usingDTable_internal(void *dst, size_t dstS
 	return dstSize;
 }
 
-size_t INIT HUF_decompress1X4_usingDTable(void *dst, size_t dstSize, const void *cSrc, size_t cSrcSize, const HUF_DTable *DTable)
+size_t __init HUF_decompress1X4_usingDTable(void *dst, size_t dstSize, const void *cSrc, size_t cSrcSize, const HUF_DTable *DTable)
 {
 	DTableDesc dtd = HUF_getDTableDesc(DTable);
 	if (dtd.tableType != 1)
@@ -687,7 +687,7 @@ size_t INIT HUF_decompress1X4_usingDTable(void *dst, size_t dstSize, const void
 	return HUF_decompress1X4_usingDTable_internal(dst, dstSize, cSrc, cSrcSize, DTable);
 }
 
-size_t INIT HUF_decompress1X4_DCtx_wksp(HUF_DTable *DCtx, void *dst, size_t dstSize, const void *cSrc, size_t cSrcSize, void *workspace, size_t workspaceSize)
+size_t __init HUF_decompress1X4_DCtx_wksp(HUF_DTable *DCtx, void *dst, size_t dstSize, const void *cSrc, size_t cSrcSize, void *workspace, size_t workspaceSize)
 {
 	const BYTE *ip = (const BYTE *)cSrc;
 
@@ -702,7 +702,7 @@ size_t INIT HUF_decompress1X4_DCtx_wksp(HUF_DTable *DCtx, void *dst, size_t dstS
 	return HUF_decompress1X4_usingDTable_internal(dst, dstSize, ip, cSrcSize, DCtx);
 }
 
-static size_t INIT HUF_decompress4X4_usingDTable_internal(void *dst, size_t dstSize, const void *cSrc, size_t cSrcSize, const HUF_DTable *DTable)
+static size_t __init HUF_decompress4X4_usingDTable_internal(void *dst, size_t dstSize, const void *cSrc, size_t cSrcSize, const HUF_DTable *DTable)
 {
 	if (cSrcSize < 10)
 		return ERROR(corruption_detected); /* strict minimum : jump table + 1 byte per stream */
@@ -812,7 +812,7 @@ static size_t INIT HUF_decompress4X4_usingDTable_internal(void *dst, size_t dstS
 	}
 }
 
-size_t INIT HUF_decompress4X4_usingDTable(void *dst, size_t dstSize, const void *cSrc, size_t cSrcSize, const HUF_DTable *DTable)
+size_t __init HUF_decompress4X4_usingDTable(void *dst, size_t dstSize, const void *cSrc, size_t cSrcSize, const HUF_DTable *DTable)
 {
 	DTableDesc dtd = HUF_getDTableDesc(DTable);
 	if (dtd.tableType != 1)
@@ -820,7 +820,7 @@ size_t INIT HUF_decompress4X4_usingDTable(void *dst, size_t dstSize, const void
 	return HUF_decompress4X4_usingDTable_internal(dst, dstSize, cSrc, cSrcSize, DTable);
 }
 
-size_t INIT HUF_decompress4X4_DCtx_wksp(HUF_DTable *dctx, void *dst, size_t dstSize, const void *cSrc, size_t cSrcSize, void *workspace, size_t workspaceSize)
+size_t __init HUF_decompress4X4_DCtx_wksp(HUF_DTable *dctx, void *dst, size_t dstSize, const void *cSrc, size_t cSrcSize, void *workspace, size_t workspaceSize)
 {
 	const BYTE *ip = (const BYTE *)cSrc;
 
@@ -839,14 +839,14 @@ size_t INIT HUF_decompress4X4_DCtx_wksp(HUF_DTable *dctx, void *dst, size_t dstS
 /* Generic decompression selector */
 /* ********************************/
 
-size_t INIT HUF_decompress1X_usingDTable(void *dst, size_t maxDstSize, const void *cSrc, size_t cSrcSize, const HUF_DTable *DTable)
+size_t __init HUF_decompress1X_usingDTable(void *dst, size_t maxDstSize, const void *cSrc, size_t cSrcSize, const HUF_DTable *DTable)
 {
 	DTableDesc const dtd = HUF_getDTableDesc(DTable);
 	return dtd.tableType ? HUF_decompress1X4_usingDTable_internal(dst, maxDstSize, cSrc, cSrcSize, DTable)
 			     : HUF_decompress1X2_usingDTable_internal(dst, maxDstSize, cSrc, cSrcSize, DTable);
 }
 
-size_t INIT HUF_decompress4X_usingDTable(void *dst, size_t maxDstSize, const void *cSrc, size_t cSrcSize, const HUF_DTable *DTable)
+size_t __init HUF_decompress4X_usingDTable(void *dst, size_t maxDstSize, const void *cSrc, size_t cSrcSize, const HUF_DTable *DTable)
 {
 	DTableDesc const dtd = HUF_getDTableDesc(DTable);
 	return dtd.tableType ? HUF_decompress4X4_usingDTable_internal(dst, maxDstSize, cSrc, cSrcSize, DTable)
@@ -882,7 +882,7 @@ static const algo_time_t algoTime[16 /* Quantization */][3 /* single, double, qu
 *   based on a set of pre-determined metrics.
 *   @return : 0==HUF_decompress4X2, 1==HUF_decompress4X4 .
 *   Assumption : 0 < cSrcSize < dstSize <= 128 KB */
-U32 INIT HUF_selectDecoder(size_t dstSize, size_t cSrcSize)
+U32 __init HUF_selectDecoder(size_t dstSize, size_t cSrcSize)
 {
 	/* decoder timing evaluation */
 	U32 const Q = (U32)(cSrcSize * 16 / dstSize); /* Q < 16 since dstSize > cSrcSize */
@@ -896,7 +896,7 @@ U32 INIT HUF_selectDecoder(size_t dstSize, size_t cSrcSize)
 
 typedef size_t (*decompressionAlgo)(void *dst, size_t dstSize, const void *cSrc, size_t cSrcSize);
 
-size_t INIT HUF_decompress4X_DCtx_wksp(HUF_DTable *dctx, void *dst, size_t dstSize, const void *cSrc, size_t cSrcSize, void *workspace, size_t workspaceSize)
+size_t __init HUF_decompress4X_DCtx_wksp(HUF_DTable *dctx, void *dst, size_t dstSize, const void *cSrc, size_t cSrcSize, void *workspace, size_t workspaceSize)
 {
 	/* validation checks */
 	if (dstSize == 0)
@@ -919,7 +919,7 @@ size_t INIT HUF_decompress4X_DCtx_wksp(HUF_DTable *dctx, void *dst, size_t dstSi
 	}
 }
 
-size_t INIT HUF_decompress4X_hufOnly_wksp(HUF_DTable *dctx, void *dst, size_t dstSize, const void *cSrc, size_t cSrcSize, void *workspace, size_t workspaceSize)
+size_t __init HUF_decompress4X_hufOnly_wksp(HUF_DTable *dctx, void *dst, size_t dstSize, const void *cSrc, size_t cSrcSize, void *workspace, size_t workspaceSize)
 {
 	/* validation checks */
 	if (dstSize == 0)
@@ -934,7 +934,7 @@ size_t INIT HUF_decompress4X_hufOnly_wksp(HUF_DTable *dctx, void *dst, size_t ds
 	}
 }
 
-size_t INIT HUF_decompress1X_DCtx_wksp(HUF_DTable *dctx, void *dst, size_t dstSize, const void *cSrc, size_t cSrcSize, void *workspace, size_t workspaceSize)
+size_t __init HUF_decompress1X_DCtx_wksp(HUF_DTable *dctx, void *dst, size_t dstSize, const void *cSrc, size_t cSrcSize, void *workspace, size_t workspaceSize)
 {
 	/* validation checks */
 	if (dstSize == 0)
diff --git a/xen/common/zstd/zstd_common.c b/xen/common/zstd/zstd_common.c
index a35c4a5f14..9a85e938cd 100644
--- a/xen/common/zstd/zstd_common.c
+++ b/xen/common/zstd/zstd_common.c
@@ -31,7 +31,7 @@
 		(stack)->ptr <= (stack)->end ? ptr : NULL;      \
 	})
 
-ZSTD_customMem INIT ZSTD_initStack(void *workspace, size_t workspaceSize)
+ZSTD_customMem __init ZSTD_initStack(void *workspace, size_t workspaceSize)
 {
 	ZSTD_customMem stackMem = {ZSTD_stackAlloc, ZSTD_stackFree, workspace};
 	ZSTD_stack *stack = (ZSTD_stack *)workspace;
@@ -47,27 +47,27 @@ ZSTD_customMem INIT ZSTD_initStack(void *workspace, size_t workspaceSize)
 	return stackMem;
 }
 
-void *INIT ZSTD_stackAllocAll(void *opaque, size_t *size)
+void *__init ZSTD_stackAllocAll(void *opaque, size_t *size)
 {
 	ZSTD_stack *stack = (ZSTD_stack *)opaque;
 	*size = (BYTE const *)stack->end - (BYTE *)ZSTD_PTR_ALIGN(stack->ptr);
 	return stack_push(stack, *size);
 }
 
-void *INIT ZSTD_stackAlloc(void *opaque, size_t size)
+void *__init ZSTD_stackAlloc(void *opaque, size_t size)
 {
 	ZSTD_stack *stack = (ZSTD_stack *)opaque;
 	return stack_push(stack, size);
 }
-void INIT ZSTD_stackFree(void *opaque, void *address)
+void __init ZSTD_stackFree(void *opaque, void *address)
 {
 	(void)opaque;
 	(void)address;
 }
 
-void *INIT ZSTD_malloc(size_t size, ZSTD_customMem customMem) { return customMem.customAlloc(customMem.opaque, size); }
+void *__init ZSTD_malloc(size_t size, ZSTD_customMem customMem) { return customMem.customAlloc(customMem.opaque, size); }
 
-void INIT ZSTD_free(void *ptr, ZSTD_customMem customMem)
+void __init ZSTD_free(void *ptr, ZSTD_customMem customMem)
 {
 	if (ptr != NULL)
 		customMem.customFree(customMem.opaque, ptr);
diff --git a/xen/common/zstd/zstd_internal.h b/xen/common/zstd/zstd_internal.h
index caa7aab406..b7dd14f6ce 100644
--- a/xen/common/zstd/zstd_internal.h
+++ b/xen/common/zstd/zstd_internal.h
@@ -21,7 +21,7 @@
 *  Compiler specifics
 *********************************************************/
 #define FORCE_INLINE static always_inline
-#define FORCE_NOINLINE static noinline INIT
+#define FORCE_NOINLINE static noinline __init
 
 /*-*************************************
 *  Dependencies
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat May 01 01:11:14 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 01 May 2021 01:11:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.120810.228427 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lceA6-0006U5-4r; Sat, 01 May 2021 01:11:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 120810.228427; Sat, 01 May 2021 01:11:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lceA6-0006Tx-1e; Sat, 01 May 2021 01:11:14 +0000
Received: by outflank-mailman (input) for mailman id 120810;
 Sat, 01 May 2021 01:11:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lceA4-0006Tl-SV
 for xen-changelog@lists.xenproject.org; Sat, 01 May 2021 01:11:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lceA4-0004Uq-Rj
 for xen-changelog@lists.xenproject.org; Sat, 01 May 2021 01:11:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lceA4-00050t-Pn
 for xen-changelog@lists.xenproject.org; Sat, 01 May 2021 01:11:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=VqG05BexzXIA5K62BjBzL662lexbP4Z9GVouYZn9q94=; b=K27AJYGTiDPA7818Dz1/JR65ZZ
	6DdNTauWNLzK4HO5PIXQ4t+psK49LNQ0s52PgqsTVyMQwehv090mCeBdzqWGfVf049RDZ5Cnu2U6G
	rAYQ5GSxn7VOgyjjNW4mxWfV/XysZrx//TEKrZo78TaH94DMoYznq+SHbDR+ZzonKFTw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/decompress: drop STATIC and INIT
Message-Id: <E1lceA4-00050t-Pn@xenbits.xenproject.org>
Date: Sat, 01 May 2021 01:11:12 +0000

commit ec0ec164877be4e99dfef2ae27eea4ca6460cdf7
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Apr 29 16:03:38 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 29 16:03:38 2021 +0200

    xen/decompress: drop STATIC and INIT
    
    Except for one last instance, all users have been removed in earlier
    changes.
    
    Requested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/efi/efi-dom0.c | 2 +-
 xen/common/decompress.h     | 6 ------
 2 files changed, 1 insertion(+), 7 deletions(-)

diff --git a/xen/arch/arm/efi/efi-dom0.c b/xen/arch/arm/efi/efi-dom0.c
index 1c356540f7..494420eaa2 100644
--- a/xen/arch/arm/efi/efi-dom0.c
+++ b/xen/arch/arm/efi/efi-dom0.c
@@ -28,7 +28,7 @@
 #include <asm/setup.h>
 #include <asm/acpi.h>
 #include "../../../common/decompress.h"
-#define XZ_EXTERN STATIC
+#define XZ_EXTERN static
 #include "../../../common/xz/crc32.c"
 
 /* Constant to indicate "Xen" in unicode u16 format */
diff --git a/xen/common/decompress.h b/xen/common/decompress.h
index 7144fb46ce..e8195b353a 100644
--- a/xen/common/decompress.h
+++ b/xen/common/decompress.h
@@ -7,9 +7,6 @@
 #include <xen/types.h>
 #include <xen/xmalloc.h>
 
-#define STATIC static
-#define INIT __init
-
 #define malloc xmalloc_bytes
 #define free xfree
 
@@ -18,9 +15,6 @@
 
 #else
 
-#define STATIC static
-#define INIT
-
 #undef __init /* tools/libs/guest/xg_private.h has its own one */
 #define __init
 #define __initdata
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat May 01 01:11:24 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 01 May 2021 01:11:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.120811.228431 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lceAG-0006VO-6W; Sat, 01 May 2021 01:11:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 120811.228431; Sat, 01 May 2021 01:11:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lceAG-0006VF-3L; Sat, 01 May 2021 01:11:24 +0000
Received: by outflank-mailman (input) for mailman id 120811;
 Sat, 01 May 2021 01:11:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lceAE-0006V5-WD
 for xen-changelog@lists.xenproject.org; Sat, 01 May 2021 01:11:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lceAE-0004Ux-VQ
 for xen-changelog@lists.xenproject.org; Sat, 01 May 2021 01:11:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lceAE-00051b-U5
 for xen-changelog@lists.xenproject.org; Sat, 01 May 2021 01:11:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=wgl9jF13rPWoXHXC3+tJJYHBvSTUTBOe2Vt8lEesyK4=; b=u1u59n/8Aj2sMBLhzyF3OVsBCs
	ChcKCZbCJqdgSybi3QRL8U+9ul4EMb/5zoLmm7XvpWU/VdypVkAnlu0F3KLuNAWHtwBEyYSz3UlR0
	FgLnox6pkeOT+5StcNRqCCmjDsT2CwzfCmAWhEvoeyPnYPrsyFpqVluUXz1muz2lOYEM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/cpuid: do not expand max leaves on restore
Message-Id: <E1lceAE-00051b-U5@xenbits.xenproject.org>
Date: Sat, 01 May 2021 01:11:22 +0000

commit 111c8c33a8a18588f3da3c5dbb7f5c63ddb98ce5
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Apr 29 16:04:11 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 29 16:04:11 2021 +0200

    x86/cpuid: do not expand max leaves on restore
    
    When restoring limit the maximum leaves to the ones supported by Xen
    4.12 in order to not expand the maximum leaves a guests sees. Note
    this is unlikely to cause real issues.
    
    Guests restored from Xen versions 4.13 or greater will contain CPUID
    data on the stream that will override the values set by
    xc_cpuid_apply_policy.
    
    Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 tools/libs/guest/xg_cpuid_x86.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/tools/libs/guest/xg_cpuid_x86.c b/tools/libs/guest/xg_cpuid_x86.c
index 5ea69ad3d5..bf9a3750b5 100644
--- a/tools/libs/guest/xg_cpuid_x86.c
+++ b/tools/libs/guest/xg_cpuid_x86.c
@@ -498,18 +498,23 @@ int xc_cpuid_apply_policy(xc_interface *xch, uint32_t domid, bool restore,
         goto out;
     }
 
-    /*
-     * Account for feature which have been disabled by default since Xen 4.13,
-     * so migrated-in VM's don't risk seeing features disappearing.
-     */
     if ( restore )
     {
+        /*
+         * Account for feature which have been disabled by default since Xen 4.13,
+         * so migrated-in VM's don't risk seeing features disappearing.
+         */
         p->basic.rdrand = test_bit(X86_FEATURE_RDRAND, host_featureset);
 
         if ( di.hvm )
         {
             p->feat.mpx = test_bit(X86_FEATURE_MPX, host_featureset);
         }
+
+        /* Clamp maximum leaves to the ones supported on 4.12. */
+        p->basic.max_leaf = min(p->basic.max_leaf, 0xdu);
+        p->feat.max_subleaf = 0;
+        p->extd.max_leaf = min(p->extd.max_leaf, 0x1cu);
     }
 
     if ( featureset )
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat May 01 01:11:34 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 01 May 2021 01:11:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.120812.228435 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lceAQ-0006Wt-7v; Sat, 01 May 2021 01:11:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 120812.228435; Sat, 01 May 2021 01:11:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lceAQ-0006Wk-4z; Sat, 01 May 2021 01:11:34 +0000
Received: by outflank-mailman (input) for mailman id 120812;
 Sat, 01 May 2021 01:11:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lceAP-0006Wb-3X
 for xen-changelog@lists.xenproject.org; Sat, 01 May 2021 01:11:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lceAP-0004V9-2m
 for xen-changelog@lists.xenproject.org; Sat, 01 May 2021 01:11:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lceAP-00052N-1U
 for xen-changelog@lists.xenproject.org; Sat, 01 May 2021 01:11:33 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=lSsltrAJDgmMs57KnZ42hxS3mudhdgsi7ty3sEgvjOo=; b=YioFK6VHLKVP0vBfrMtwkw2yiF
	5H/WHbMOamErcs3urUw+VoJuQ9fCQ14wGud6Nf96tj3nQ9P1bCWGhQZJvUBSR3JqOxAH5C8ZK289g
	dypphjkfRPRUcHyayoo1t7kn0S6AdJIRxomXuok1UJ0hT2Ix9DNszkmQATEz0HO4NBI4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86: correct comment about alternatives ordering
Message-Id: <E1lceAP-00052N-1U@xenbits.xenproject.org>
Date: Sat, 01 May 2021 01:11:33 +0000

commit 9a5071e80be67e7a480ef9ba9680af6754198cdb
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Apr 29 16:04:35 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 29 16:04:35 2021 +0200

    x86: correct comment about alternatives ordering
    
    Unlike Linux, Xen has never (so far) used alternatives patching for
    memcpy() or memset(), even less such utilizing multiple alternatives.
    Correct the Linux-inherited comment to match reality.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/alternative.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/xen/arch/x86/alternative.c b/xen/arch/x86/alternative.c
index 004e9ede25..1cb531c9df 100644
--- a/xen/arch/x86/alternative.c
+++ b/xen/arch/x86/alternative.c
@@ -194,8 +194,7 @@ static void init_or_livepatch _apply_alternatives(struct alt_instr *start,
     /*
      * The scan order should be from start to end. A later scanned
      * alternative code can overwrite a previous scanned alternative code.
-     * Some kernel functions (e.g. memcpy, memset, etc) use this order to
-     * patch code.
+     * Some code (e.g. ALTERNATIVE_2()) relies on this order of patching.
      *
      * So be careful if you want to change the scan order to any other
      * order.
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat May 01 01:11:44 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 01 May 2021 01:11:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.120813.228438 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lceAa-0006YM-9O; Sat, 01 May 2021 01:11:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 120813.228438; Sat, 01 May 2021 01:11:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lceAa-0006YG-6R; Sat, 01 May 2021 01:11:44 +0000
Received: by outflank-mailman (input) for mailman id 120813;
 Sat, 01 May 2021 01:11:43 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lceAZ-0006Y7-6e
 for xen-changelog@lists.xenproject.org; Sat, 01 May 2021 01:11:43 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lceAZ-0004Vb-5u
 for xen-changelog@lists.xenproject.org; Sat, 01 May 2021 01:11:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lceAZ-00053G-50
 for xen-changelog@lists.xenproject.org; Sat, 01 May 2021 01:11:43 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=DPUlPOlDt70K95K1gJqmpwyVTvViqHwrmAeJs0+fYlg=; b=lXfy0Y+fb24Vl/YdS+jZ5I/sqB
	zAhJ0NrHRwNc230ZB05Euft6fBdbbiUYLOpfdbjiv+y6bOSDhXBQWKNKibeEIl+Q2uJ93+x5RwtF2
	Yd5moHe6+evWiX5dRWoiRfrw+132B/UtkIl1ANR8228CbqpXOaJyqk8XPDO0G3aBKgiA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/oprofile: remove compat accessors usage from backtrace
Message-Id: <E1lceAZ-00053G-50@xenbits.xenproject.org>
Date: Sat, 01 May 2021 01:11:43 +0000

commit 39e7a942738f1ef48878fff67d140bbc0c83e7ff
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Apr 29 16:05:00 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 29 16:05:00 2021 +0200

    x86/oprofile: remove compat accessors usage from backtrace
    
    Remove the unneeded usage of the compat layer to copy frame pointers
    from guest address space. Instead just use raw_copy_from_guest.
    
    While there change the accessibility check of one frame_head beyond to
    be performed as part of the copy, like it's done in the Linux code in
    5.11 and earlier versions. Note it's unclear why this is needed.
    
    Also drop the explicit truncation of the head pointer in the 32bit
    case as all callers already pass a zero extended value. The first
    value being rsp from the guest registers, and further calls will use
    ebp from frame_head_32bit struct.
    
    Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/oprofile/backtrace.c | 41 +++++++++++----------------------------
 1 file changed, 11 insertions(+), 30 deletions(-)

diff --git a/xen/arch/x86/oprofile/backtrace.c b/xen/arch/x86/oprofile/backtrace.c
index bd5d1b0f6c..61de18c8d5 100644
--- a/xen/arch/x86/oprofile/backtrace.c
+++ b/xen/arch/x86/oprofile/backtrace.c
@@ -20,7 +20,6 @@ struct __packed frame_head {
     unsigned long ret;
 };
 typedef struct frame_head frame_head_t;
-DEFINE_XEN_GUEST_HANDLE(frame_head_t);
 
 struct __packed frame_head_32bit {
     uint32_t ebp;
@@ -43,7 +42,6 @@ dump_hypervisor_backtrace(struct vcpu *vcpu, const struct frame_head *head,
     return head->ebp;
 }
 
-#ifdef CONFIG_COMPAT
 static inline int is_32bit_vcpu(struct vcpu *vcpu)
 {
     if (is_hvm_vcpu(vcpu))
@@ -51,52 +49,35 @@ static inline int is_32bit_vcpu(struct vcpu *vcpu)
     else
         return is_pv_32bit_vcpu(vcpu);
 }
-#endif
 
 static struct frame_head *
 dump_guest_backtrace(struct vcpu *vcpu, const struct frame_head *head,
                      int mode)
 {
-    frame_head_t bufhead;
+    /* Also check accessibility of one struct frame_head beyond. */
+    frame_head_t bufhead[2];
 
-#ifdef CONFIG_COMPAT
     if ( is_32bit_vcpu(vcpu) )
     {
-        DEFINE_COMPAT_HANDLE(frame_head32_t);
-        __compat_handle_const_frame_head32_t guest_head =
-            { .c = (unsigned long)head };
-        frame_head32_t bufhead32;
-
-        /* Also check accessibility of one struct frame_head beyond */
-        if (!compat_handle_okay(guest_head, 2))
-            return 0;
-        if (__copy_from_compat(&bufhead32, guest_head, 1))
-            return 0;
-        bufhead.ebp = (struct frame_head *)(unsigned long)bufhead32.ebp;
-        bufhead.ret = bufhead32.ret;
-    }
-    else
-#endif
-    {
-        XEN_GUEST_HANDLE_PARAM(const_frame_head_t) guest_head =
-            const_guest_handle_from_ptr(head, frame_head_t);
+        frame_head32_t bufhead32[2];
 
-        /* Also check accessibility of one struct frame_head beyond */
-        if (!guest_handle_okay(guest_head, 2))
-            return 0;
-        if (__copy_from_guest(&bufhead, guest_head, 1))
+        if ( raw_copy_from_guest(bufhead32, head, sizeof(bufhead32)) )
             return 0;
+        bufhead[0].ebp = (struct frame_head *)(unsigned long)bufhead32[0].ebp;
+        bufhead[0].ret = bufhead32[0].ret;
     }
+    else if ( raw_copy_from_guest(bufhead, head, sizeof(bufhead)) )
+        return 0;
     
-    if (!xenoprof_add_trace(vcpu, bufhead.ret, mode))
+    if ( !xenoprof_add_trace(vcpu, bufhead[0].ret, mode) )
         return 0;
     
     /* frame pointers should strictly progress back up the stack
      * (towards higher addresses) */
-    if (head >= bufhead.ebp)
+    if ( head >= bufhead[0].ebp )
         return NULL;
     
-    return bufhead.ebp;
+    return bufhead[0].ebp;
 }
 
 /*
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat May 01 01:11:54 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 01 May 2021 01:11:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.120814.228443 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lceAk-0006Zw-BY; Sat, 01 May 2021 01:11:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 120814.228443; Sat, 01 May 2021 01:11:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lceAk-0006Zo-8d; Sat, 01 May 2021 01:11:54 +0000
Received: by outflank-mailman (input) for mailman id 120814;
 Sat, 01 May 2021 01:11:53 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lceAj-0006Zf-A7
 for xen-changelog@lists.xenproject.org; Sat, 01 May 2021 01:11:53 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lceAj-0004Vo-9H
 for xen-changelog@lists.xenproject.org; Sat, 01 May 2021 01:11:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lceAj-00053w-8M
 for xen-changelog@lists.xenproject.org; Sat, 01 May 2021 01:11:53 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=zmnAbGieiQ7ZrqKnxQ4NzHAWHCrEO5lJ3UfYbbZ75cU=; b=FGgMow73PWK/9ikRrYGPNaaQQb
	O28O7mW8KP8kmRurtZZpPSV0K3eBKVi3AeWwwbz1sXmzgnr77Vuqn6K3hCe+HKBA1qOh07yB1VXjv
	D//wO3dLVvLqunBOGV4sQR0a4eFjS04rPJFpE9px3/bKCEkSjLmB2gjzM+BCrqhX//LM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] libs/guest: rename xc_get_cpu_policy_size to xc_cpu_policy_get_size
Message-Id: <E1lceAj-00053w-8M@xenbits.xenproject.org>
Date: Sat, 01 May 2021 01:11:53 +0000

commit 537ae417853233a103b761adfd5d191794018f0a
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Mon Mar 22 10:37:35 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Apr 29 19:27:21 2021 +0100

    libs/guest: rename xc_get_cpu_policy_size to xc_cpu_policy_get_size
    
    Preparatory change to introduce a new set of xc_cpu_policy_* functions
    that will replace the current CPUID/MSR helpers.
    
    No functional change intended.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/include/xenctrl.h             | 2 +-
 tools/libs/guest/xg_cpuid_x86.c     | 6 +++---
 tools/libs/guest/xg_sr_common_x86.c | 2 +-
 tools/misc/xen-cpuid.c              | 2 +-
 4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/tools/include/xenctrl.h b/tools/include/xenctrl.h
index 318920166c..e91ff92b9b 100644
--- a/tools/include/xenctrl.h
+++ b/tools/include/xenctrl.h
@@ -2594,7 +2594,7 @@ int xc_get_cpu_levelling_caps(xc_interface *xch, uint32_t *caps);
 int xc_get_cpu_featureset(xc_interface *xch, uint32_t index,
                           uint32_t *nr_features, uint32_t *featureset);
 
-int xc_get_cpu_policy_size(xc_interface *xch, uint32_t *nr_leaves,
+int xc_cpu_policy_get_size(xc_interface *xch, uint32_t *nr_leaves,
                            uint32_t *nr_msrs);
 int xc_get_system_cpu_policy(xc_interface *xch, uint32_t index,
                              uint32_t *nr_leaves, xen_cpuid_leaf_t *leaves,
diff --git a/tools/libs/guest/xg_cpuid_x86.c b/tools/libs/guest/xg_cpuid_x86.c
index bf9a3750b5..4491a68bd7 100644
--- a/tools/libs/guest/xg_cpuid_x86.c
+++ b/tools/libs/guest/xg_cpuid_x86.c
@@ -109,7 +109,7 @@ const uint32_t *xc_get_static_cpu_featuremask(
     return masks[mask];
 }
 
-int xc_get_cpu_policy_size(xc_interface *xch, uint32_t *nr_leaves,
+int xc_cpu_policy_get_size(xc_interface *xch, uint32_t *nr_leaves,
                            uint32_t *nr_msrs)
 {
     struct xen_sysctl sysctl = {};
@@ -302,7 +302,7 @@ static int xc_cpuid_xend_policy(
         goto fail;
     }
 
-    rc = xc_get_cpu_policy_size(xch, &nr_leaves, &nr_msrs);
+    rc = xc_cpu_policy_get_size(xch, &nr_leaves, &nr_msrs);
     if ( rc )
     {
         PERROR("Failed to obtain policy info size");
@@ -448,7 +448,7 @@ int xc_cpuid_apply_policy(xc_interface *xch, uint32_t domid, bool restore,
         goto out;
     }
 
-    rc = xc_get_cpu_policy_size(xch, &nr_leaves, &nr_msrs);
+    rc = xc_cpu_policy_get_size(xch, &nr_leaves, &nr_msrs);
     if ( rc )
     {
         PERROR("Failed to obtain policy info size");
diff --git a/tools/libs/guest/xg_sr_common_x86.c b/tools/libs/guest/xg_sr_common_x86.c
index 3168c5485f..4982519e05 100644
--- a/tools/libs/guest/xg_sr_common_x86.c
+++ b/tools/libs/guest/xg_sr_common_x86.c
@@ -50,7 +50,7 @@ int write_x86_cpu_policy_records(struct xc_sr_context *ctx)
     uint32_t nr_leaves = 0, nr_msrs = 0;
     int rc;
 
-    if ( xc_get_cpu_policy_size(xch, &nr_leaves, &nr_msrs) < 0 )
+    if ( xc_cpu_policy_get_size(xch, &nr_leaves, &nr_msrs) < 0 )
     {
         PERROR("Unable to get CPU Policy size");
         return -1;
diff --git a/tools/misc/xen-cpuid.c b/tools/misc/xen-cpuid.c
index a17ad07832..027b25ad01 100644
--- a/tools/misc/xen-cpuid.c
+++ b/tools/misc/xen-cpuid.c
@@ -472,7 +472,7 @@ int main(int argc, char **argv)
         if ( !xch )
             err(1, "xc_interface_open");
 
-        if ( xc_get_cpu_policy_size(xch, &max_leaves, &max_msrs) )
+        if ( xc_cpu_policy_get_size(xch, &max_leaves, &max_msrs) )
             err(1, "xc_get_cpu_policy_size(...)");
         if ( domid == -1 )
             printf("Xen reports there are maximum %u leaves and %u MSRs\n",
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat May 01 01:12:04 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 01 May 2021 01:12:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.120816.228447 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lceAu-0006bN-DD; Sat, 01 May 2021 01:12:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 120816.228447; Sat, 01 May 2021 01:12:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lceAu-0006bE-A5; Sat, 01 May 2021 01:12:04 +0000
Received: by outflank-mailman (input) for mailman id 120816;
 Sat, 01 May 2021 01:12:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lceAt-0006b4-DI
 for xen-changelog@lists.xenproject.org; Sat, 01 May 2021 01:12:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lceAt-0004WC-CO
 for xen-changelog@lists.xenproject.org; Sat, 01 May 2021 01:12:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lceAt-00054h-Bj
 for xen-changelog@lists.xenproject.org; Sat, 01 May 2021 01:12:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=gP3DyjlQcab3Ch2FEArSCw26Jl803SKcX1fFNOsLdLE=; b=HrpfMiCAtjFfyYCssh2dzUSwTD
	0yZNRA+SArb+jqPZ9NqXdbFAYvtg+ajJlfC5Hul173YyUSQ9Mr/fKeY5sdpR11sNjU+rAxwu6xj9V
	ooL0Q6icmjZbO+l2ir+sofHWGKcemo1LJHyrae+O6/EKxrQSh2Hn/rv+zVgGnIr/rhto=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] libs/guest: introduce xc_cpu_policy_t
Message-Id: <E1lceAt-00054h-Bj@xenbits.xenproject.org>
Date: Sat, 01 May 2021 01:12:03 +0000

commit 989ec5bd1d790ef53db2cf0f12244d10b07bfa3a
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Tue Mar 16 16:39:00 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Apr 29 19:27:21 2021 +0100

    libs/guest: introduce xc_cpu_policy_t
    
    Introduce an opaque type that is used to store the CPUID and MSRs
    policies of a domain. Such type uses the existing {cpuid,msr}_policy
    structures to store the data, but doesn't expose the type to the users
    of the xenguest library. There are also two arrays to allow for easier
    serialization without requiring an allocation each time.
    
    Introduce an allocation (init) and freeing function (destroy) to
    manage the type.
    
    Note the type is not yet used anywhere.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/include/xenctrl.h         |  6 ++++++
 tools/libs/guest/xg_cpuid_x86.c | 18 ++++++++++++++++++
 2 files changed, 24 insertions(+)

diff --git a/tools/include/xenctrl.h b/tools/include/xenctrl.h
index e91ff92b9b..1aba814f01 100644
--- a/tools/include/xenctrl.h
+++ b/tools/include/xenctrl.h
@@ -2590,6 +2590,12 @@ int xc_psr_get_domain_data(xc_interface *xch, uint32_t domid,
 int xc_psr_get_hw_info(xc_interface *xch, uint32_t socket,
                        xc_psr_feat_type type, xc_psr_hw_info *hw_info);
 
+typedef struct xc_cpu_policy *xc_cpu_policy_t;
+
+/* Create and free a xc_cpu_policy object. */
+xc_cpu_policy_t xc_cpu_policy_init(void);
+void xc_cpu_policy_destroy(xc_cpu_policy_t policy);
+
 int xc_get_cpu_levelling_caps(xc_interface *xch, uint32_t *caps);
 int xc_get_cpu_featureset(xc_interface *xch, uint32_t index,
                           uint32_t *nr_features, uint32_t *featureset);
diff --git a/tools/libs/guest/xg_cpuid_x86.c b/tools/libs/guest/xg_cpuid_x86.c
index 4491a68bd7..39d62fe2f3 100644
--- a/tools/libs/guest/xg_cpuid_x86.c
+++ b/tools/libs/guest/xg_cpuid_x86.c
@@ -39,6 +39,13 @@ enum {
 #define bitmaskof(idx)      (1u << ((idx) & 31))
 #define featureword_of(idx) ((idx) >> 5)
 
+struct xc_cpu_policy {
+    struct cpuid_policy cpuid;
+    struct msr_policy msr;
+    xen_cpuid_leaf_t leaves[CPUID_MAX_SERIALISED_LEAVES];
+    xen_msr_entry_t entries[MSR_MAX_SERIALISED_ENTRIES];
+};
+
 int xc_get_cpu_levelling_caps(xc_interface *xch, uint32_t *caps)
 {
     DECLARE_SYSCTL;
@@ -665,3 +672,14 @@ out:
 
     return rc;
 }
+
+xc_cpu_policy_t xc_cpu_policy_init(void)
+{
+    return calloc(1, sizeof(struct xc_cpu_policy));
+}
+
+void xc_cpu_policy_destroy(xc_cpu_policy_t policy)
+{
+    if ( policy )
+        free(policy);
+}
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat May 01 01:12:14 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 01 May 2021 01:12:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.120817.228451 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lceB4-0006ci-Ec; Sat, 01 May 2021 01:12:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 120817.228451; Sat, 01 May 2021 01:12:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lceB4-0006ca-Bb; Sat, 01 May 2021 01:12:14 +0000
Received: by outflank-mailman (input) for mailman id 120817;
 Sat, 01 May 2021 01:12:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lceB3-0006cT-Ga
 for xen-changelog@lists.xenproject.org; Sat, 01 May 2021 01:12:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lceB3-0004WK-Fu
 for xen-changelog@lists.xenproject.org; Sat, 01 May 2021 01:12:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lceB3-00055M-F6
 for xen-changelog@lists.xenproject.org; Sat, 01 May 2021 01:12:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=PbTzL/LX4oAT3gjzeNMIWMb9IB+6J1AOlpawRTLjZKI=; b=bYqCBPPztk2v7vEW0sNgL3/wf+
	FmecW8e1K4qu/a+0dmjasHzfa03aCK/RaD8hV48t5OJ4afnHtfjqiRuaqMZjUDApGiO6PU3znNbim
	CW0DnOTVmaC/WYCzYqsrUwSziAq93OX1sjla38yAKK9R+qtxGx4LMBrnTBde6MXuhp5A=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] libs/guest: introduce helper to fetch a system cpu policy
Message-Id: <E1lceB3-00055M-F6@xenbits.xenproject.org>
Date: Sat, 01 May 2021 01:12:13 +0000

commit a877e31f9d6e6cb435c10e9c539b02bd451969a9
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Wed Mar 17 14:45:41 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Apr 29 19:27:21 2021 +0100

    libs/guest: introduce helper to fetch a system cpu policy
    
    Such helper is based on the existing functions to fetch a CPUID and
    MSR policies, but uses the xc_cpu_policy_t type to return the data to
    the caller.
    
    Note some helper functions are introduced, those are split from
    xc_cpu_policy_get_system because they will be used by other functions
    also.
    
    No user of the interface introduced on the patch.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/include/xenctrl.h         |  4 +++
 tools/libs/guest/xg_cpuid_x86.c | 54 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 58 insertions(+)

diff --git a/tools/include/xenctrl.h b/tools/include/xenctrl.h
index 1aba814f01..187df5c5d2 100644
--- a/tools/include/xenctrl.h
+++ b/tools/include/xenctrl.h
@@ -2596,6 +2596,10 @@ typedef struct xc_cpu_policy *xc_cpu_policy_t;
 xc_cpu_policy_t xc_cpu_policy_init(void);
 void xc_cpu_policy_destroy(xc_cpu_policy_t policy);
 
+/* Retrieve a system policy, or get/set a domains policy. */
+int xc_cpu_policy_get_system(xc_interface *xch, unsigned int policy_idx,
+                             xc_cpu_policy_t policy);
+
 int xc_get_cpu_levelling_caps(xc_interface *xch, uint32_t *caps);
 int xc_get_cpu_featureset(xc_interface *xch, uint32_t index,
                           uint32_t *nr_features, uint32_t *featureset);
diff --git a/tools/libs/guest/xg_cpuid_x86.c b/tools/libs/guest/xg_cpuid_x86.c
index 39d62fe2f3..dad560fb40 100644
--- a/tools/libs/guest/xg_cpuid_x86.c
+++ b/tools/libs/guest/xg_cpuid_x86.c
@@ -683,3 +683,57 @@ void xc_cpu_policy_destroy(xc_cpu_policy_t policy)
     if ( policy )
         free(policy);
 }
+
+static int deserialize_policy(xc_interface *xch, xc_cpu_policy_t policy,
+                              unsigned int nr_leaves, unsigned int nr_entries)
+{
+    uint32_t err_leaf = -1, err_subleaf = -1, err_msr = -1;
+    int rc;
+
+    rc = x86_cpuid_copy_from_buffer(&policy->cpuid, policy->leaves,
+                                    nr_leaves, &err_leaf, &err_subleaf);
+    if ( rc )
+    {
+        if ( err_leaf != -1 )
+            ERROR("Failed to deserialise CPUID (err leaf %#x, subleaf %#x) (%d = %s)",
+                  err_leaf, err_subleaf, -rc, strerror(-rc));
+        return rc;
+    }
+
+    rc = x86_msr_copy_from_buffer(&policy->msr, policy->entries,
+                                  nr_entries, &err_msr);
+    if ( rc )
+    {
+        if ( err_msr != -1 )
+            ERROR("Failed to deserialise MSR (err MSR %#x) (%d = %s)",
+                  err_msr, -rc, strerror(-rc));
+        return rc;
+    }
+
+    return 0;
+}
+
+int xc_cpu_policy_get_system(xc_interface *xch, unsigned int policy_idx,
+                             xc_cpu_policy_t policy)
+{
+    unsigned int nr_leaves = ARRAY_SIZE(policy->leaves);
+    unsigned int nr_entries = ARRAY_SIZE(policy->entries);
+    int rc;
+
+    rc = xc_get_system_cpu_policy(xch, policy_idx, &nr_leaves, policy->leaves,
+                                  &nr_entries, policy->entries);
+    if ( rc )
+    {
+        PERROR("Failed to obtain %u policy", policy_idx);
+        return rc;
+    }
+
+    rc = deserialize_policy(xch, policy, nr_leaves, nr_entries);
+    if ( rc )
+    {
+        errno = -rc;
+        rc = -1;
+    }
+
+    return rc;
+}
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat May 01 01:12:24 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 01 May 2021 01:12:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.120818.228455 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lceBE-0006eD-HW; Sat, 01 May 2021 01:12:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 120818.228455; Sat, 01 May 2021 01:12:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lceBE-0006e5-Eb; Sat, 01 May 2021 01:12:24 +0000
Received: by outflank-mailman (input) for mailman id 120818;
 Sat, 01 May 2021 01:12:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lceBD-0006dx-Jx
 for xen-changelog@lists.xenproject.org; Sat, 01 May 2021 01:12:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lceBD-0004WS-JA
 for xen-changelog@lists.xenproject.org; Sat, 01 May 2021 01:12:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lceBD-00055x-IP
 for xen-changelog@lists.xenproject.org; Sat, 01 May 2021 01:12:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=vPerITRKychRJXmHG/46d/dPKwTHetdCEw6CU3REDcc=; b=iWg62rI1w9kCsktSyQivam4R1g
	0LCqKYIDP1W5Iva9xblbszLftdubqtd6P6N2yw8IbWwjBy4RqKgzVmidRysuSLTBZUwRGjTm8bHs9
	OyXB7iU4H8nG8zX18DHDhiIodi7YoZzTEtx4/S3jTDriWZ9MF7zagAF6EflHgjQs6SZU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] libs/guest: introduce helper to fetch a domain cpu policy
Message-Id: <E1lceBD-00055x-IP@xenbits.xenproject.org>
Date: Sat, 01 May 2021 01:12:23 +0000

commit c79d253226de3466cbc41401014d9a35507bff33
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Wed Mar 17 14:46:11 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Apr 29 19:27:21 2021 +0100

    libs/guest: introduce helper to fetch a domain cpu policy
    
    Such helper is based on the existing functions to fetch a CPUID and
    MSR policies, but uses the xc_cpu_policy_t type to return the data to
    the caller.
    
    No user of the interface introduced on the patch.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/include/xenctrl.h         |  2 ++
 tools/libs/guest/xg_cpuid_x86.c | 25 +++++++++++++++++++++++++
 2 files changed, 27 insertions(+)

diff --git a/tools/include/xenctrl.h b/tools/include/xenctrl.h
index 187df5c5d2..34d979d11d 100644
--- a/tools/include/xenctrl.h
+++ b/tools/include/xenctrl.h
@@ -2599,6 +2599,8 @@ void xc_cpu_policy_destroy(xc_cpu_policy_t policy);
 /* Retrieve a system policy, or get/set a domains policy. */
 int xc_cpu_policy_get_system(xc_interface *xch, unsigned int policy_idx,
                              xc_cpu_policy_t policy);
+int xc_cpu_policy_get_domain(xc_interface *xch, uint32_t domid,
+                             xc_cpu_policy_t policy);
 
 int xc_get_cpu_levelling_caps(xc_interface *xch, uint32_t *caps);
 int xc_get_cpu_featureset(xc_interface *xch, uint32_t index,
diff --git a/tools/libs/guest/xg_cpuid_x86.c b/tools/libs/guest/xg_cpuid_x86.c
index dad560fb40..2cbc4b550f 100644
--- a/tools/libs/guest/xg_cpuid_x86.c
+++ b/tools/libs/guest/xg_cpuid_x86.c
@@ -737,3 +737,28 @@ int xc_cpu_policy_get_system(xc_interface *xch, unsigned int policy_idx,
 
     return rc;
 }
+
+int xc_cpu_policy_get_domain(xc_interface *xch, uint32_t domid,
+                             xc_cpu_policy_t policy)
+{
+    unsigned int nr_leaves = ARRAY_SIZE(policy->leaves);
+    unsigned int nr_entries = ARRAY_SIZE(policy->entries);
+    int rc;
+
+    rc = xc_get_domain_cpu_policy(xch, domid, &nr_leaves, policy->leaves,
+                                  &nr_entries, policy->entries);
+    if ( rc )
+    {
+        PERROR("Failed to obtain domain %u policy", domid);
+        return rc;
+    }
+
+    rc = deserialize_policy(xch, policy, nr_leaves, nr_entries);
+    if ( rc )
+    {
+        errno = -rc;
+        rc = -1;
+    }
+
+    return rc;
+}
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat May 01 01:12:34 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 01 May 2021 01:12:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.120819.228461 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lceBO-0006fa-Ji; Sat, 01 May 2021 01:12:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 120819.228461; Sat, 01 May 2021 01:12:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lceBO-0006fS-GA; Sat, 01 May 2021 01:12:34 +0000
Received: by outflank-mailman (input) for mailman id 120819;
 Sat, 01 May 2021 01:12:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lceBN-0006fK-Mw
 for xen-changelog@lists.xenproject.org; Sat, 01 May 2021 01:12:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lceBN-0004Wa-M9
 for xen-changelog@lists.xenproject.org; Sat, 01 May 2021 01:12:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lceBN-00056a-LT
 for xen-changelog@lists.xenproject.org; Sat, 01 May 2021 01:12:33 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=WaFCqkQpFBLkq3N0z/5PclOkffCmCQdolZk5BcPNZY4=; b=RSIQT3ykD4pgJe+/+Kb7jlicsq
	o3/ugZXaFS2EsTCBXgeGOi+SjATVSWtG1ZOZuSLZ5dy1wxKyrvXwM+W+tSA+jBaVFKSZRPyvV1p5/
	TgThcmZ4n6EftiNttKkEighihr+OOzi9Yxp/zNUAWj4Am3m5CG85fPmlJASvCRr4UlO0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] libs/guest: introduce helper to serialize a cpu policy
Message-Id: <E1lceBN-00056a-LT@xenbits.xenproject.org>
Date: Sat, 01 May 2021 01:12:33 +0000

commit de75c946cfd3d65b4511c970f14e331a54544b12
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Wed Mar 17 15:31:50 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Apr 29 19:27:21 2021 +0100

    libs/guest: introduce helper to serialize a cpu policy
    
    Such helper allow converting a cpu policy into an array of
    xen_cpuid_leaf_t and xen_msr_entry_t elements, which matches the
    current interface of the CPUID/MSR functions. This is required in
    order for the user to be able to parse the CPUID/MSR data.
    
    No user of the interface introduced in this patch.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
---
 tools/include/xenctrl.h         |  5 +++++
 tools/libs/guest/xg_cpuid_x86.c | 32 ++++++++++++++++++++++++++++++++
 2 files changed, 37 insertions(+)

diff --git a/tools/include/xenctrl.h b/tools/include/xenctrl.h
index 34d979d11d..a4827b1ae6 100644
--- a/tools/include/xenctrl.h
+++ b/tools/include/xenctrl.h
@@ -2602,6 +2602,11 @@ int xc_cpu_policy_get_system(xc_interface *xch, unsigned int policy_idx,
 int xc_cpu_policy_get_domain(xc_interface *xch, uint32_t domid,
                              xc_cpu_policy_t policy);
 
+/* Manipulate a policy via architectural representations. */
+int xc_cpu_policy_serialise(xc_interface *xch, const xc_cpu_policy_t policy,
+                            xen_cpuid_leaf_t *leaves, uint32_t *nr_leaves,
+                            xen_msr_entry_t *msrs, uint32_t *nr_msrs);
+
 int xc_get_cpu_levelling_caps(xc_interface *xch, uint32_t *caps);
 int xc_get_cpu_featureset(xc_interface *xch, uint32_t index,
                           uint32_t *nr_features, uint32_t *featureset);
diff --git a/tools/libs/guest/xg_cpuid_x86.c b/tools/libs/guest/xg_cpuid_x86.c
index 2cbc4b550f..03884587b9 100644
--- a/tools/libs/guest/xg_cpuid_x86.c
+++ b/tools/libs/guest/xg_cpuid_x86.c
@@ -762,3 +762,35 @@ int xc_cpu_policy_get_domain(xc_interface *xch, uint32_t domid,
 
     return rc;
 }
+
+int xc_cpu_policy_serialise(xc_interface *xch, const xc_cpu_policy_t p,
+                            xen_cpuid_leaf_t *leaves, uint32_t *nr_leaves,
+                            xen_msr_entry_t *msrs, uint32_t *nr_msrs)
+{
+    int rc;
+
+    if ( leaves )
+    {
+        rc = x86_cpuid_copy_to_buffer(&p->cpuid, leaves, nr_leaves);
+        if ( rc )
+        {
+            ERROR("Failed to serialize CPUID policy");
+            errno = -rc;
+            return -1;
+        }
+    }
+
+    if ( msrs )
+    {
+        rc = x86_msr_copy_to_buffer(&p->msr, msrs, nr_msrs);
+        if ( rc )
+        {
+            ERROR("Failed to serialize MSR policy");
+            errno = -rc;
+            return -1;
+        }
+    }
+
+    errno = 0;
+    return 0;
+}
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat May 01 01:12:44 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 01 May 2021 01:12:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.120820.228465 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lceBY-0006hG-Lm; Sat, 01 May 2021 01:12:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 120820.228465; Sat, 01 May 2021 01:12:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lceBY-0006h3-Hl; Sat, 01 May 2021 01:12:44 +0000
Received: by outflank-mailman (input) for mailman id 120820;
 Sat, 01 May 2021 01:12:43 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lceBX-0006gh-Pz
 for xen-changelog@lists.xenproject.org; Sat, 01 May 2021 01:12:43 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lceBX-0004Wx-P8
 for xen-changelog@lists.xenproject.org; Sat, 01 May 2021 01:12:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lceBX-00057L-OX
 for xen-changelog@lists.xenproject.org; Sat, 01 May 2021 01:12:43 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=MyTkbJjdD8OCq566GILIYVyk0/baehOmf5P5di53oOk=; b=fRQ/ZJRNb2Yz8sLsQeiiKIkWmn
	vW5PKknWswNVaS2GSfRHg2y9fqDWdPFwdzifHrXOvEK21kQz+K8HbeBo7ECjY9i9pnfoVfkankibh
	r4YxOnZbkPwTb7Irk5ySS/YxeJI74Lp7YPVAE4ZNFcCDbgrW10pDWac4HcchWcldTyrI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools: switch existing users of xc_get_{system,domain}_cpu_policy
Message-Id: <E1lceBX-00057L-OX@xenbits.xenproject.org>
Date: Sat, 01 May 2021 01:12:43 +0000

commit 29736eaeae545b37e4fd97a4077de681920d57a0
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Mon Mar 22 11:59:04 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Apr 29 19:27:21 2021 +0100

    tools: switch existing users of xc_get_{system,domain}_cpu_policy
    
    With the introduction of xc_cpu_policy_get_{system,domain} and
    xc_cpu_policy_serialise the current users of
    xc_get_{system,domain}_cpu_policy can be switched to the new
    interface.
    
    Note that xc_get_{system,domain}_cpu_policy is removed from the public
    interface and the functions are made static, since there are still
    internal consumers in xg_cpuid_x86.c
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/include/xenctrl.h             |  6 ------
 tools/libs/guest/xg_cpuid_x86.c     | 39 ++++++++++++++++++-------------------
 tools/libs/guest/xg_sr_common_x86.c | 15 +++++++++++---
 tools/misc/xen-cpuid.c              | 21 +++++++++++++-------
 4 files changed, 45 insertions(+), 36 deletions(-)

diff --git a/tools/include/xenctrl.h b/tools/include/xenctrl.h
index a4827b1ae6..e9a86d63ba 100644
--- a/tools/include/xenctrl.h
+++ b/tools/include/xenctrl.h
@@ -2613,12 +2613,6 @@ int xc_get_cpu_featureset(xc_interface *xch, uint32_t index,
 
 int xc_cpu_policy_get_size(xc_interface *xch, uint32_t *nr_leaves,
                            uint32_t *nr_msrs);
-int xc_get_system_cpu_policy(xc_interface *xch, uint32_t index,
-                             uint32_t *nr_leaves, xen_cpuid_leaf_t *leaves,
-                             uint32_t *nr_msrs, xen_msr_entry_t *msrs);
-int xc_get_domain_cpu_policy(xc_interface *xch, uint32_t domid,
-                             uint32_t *nr_leaves, xen_cpuid_leaf_t *leaves,
-                             uint32_t *nr_msrs, xen_msr_entry_t *msrs);
 int xc_set_domain_cpu_policy(xc_interface *xch, uint32_t domid,
                              uint32_t nr_leaves, xen_cpuid_leaf_t *leaves,
                              uint32_t nr_msrs, xen_msr_entry_t *msrs,
diff --git a/tools/libs/guest/xg_cpuid_x86.c b/tools/libs/guest/xg_cpuid_x86.c
index 03884587b9..bbdabb3a63 100644
--- a/tools/libs/guest/xg_cpuid_x86.c
+++ b/tools/libs/guest/xg_cpuid_x86.c
@@ -135,9 +135,9 @@ int xc_cpu_policy_get_size(xc_interface *xch, uint32_t *nr_leaves,
     return ret;
 }
 
-int xc_get_system_cpu_policy(xc_interface *xch, uint32_t index,
-                             uint32_t *nr_leaves, xen_cpuid_leaf_t *leaves,
-                             uint32_t *nr_msrs, xen_msr_entry_t *msrs)
+static int get_system_cpu_policy(xc_interface *xch, uint32_t index,
+                                 uint32_t *nr_leaves, xen_cpuid_leaf_t *leaves,
+                                 uint32_t *nr_msrs, xen_msr_entry_t *msrs)
 {
     struct xen_sysctl sysctl = {};
     DECLARE_HYPERCALL_BOUNCE(leaves,
@@ -173,9 +173,9 @@ int xc_get_system_cpu_policy(xc_interface *xch, uint32_t index,
     return ret;
 }
 
-int xc_get_domain_cpu_policy(xc_interface *xch, uint32_t domid,
-                             uint32_t *nr_leaves, xen_cpuid_leaf_t *leaves,
-                             uint32_t *nr_msrs, xen_msr_entry_t *msrs)
+static int get_domain_cpu_policy(xc_interface *xch, uint32_t domid,
+                                 uint32_t *nr_leaves, xen_cpuid_leaf_t *leaves,
+                                 uint32_t *nr_msrs, xen_msr_entry_t *msrs)
 {
     DECLARE_DOMCTL;
     DECLARE_HYPERCALL_BOUNCE(leaves,
@@ -329,7 +329,7 @@ static int xc_cpuid_xend_policy(
     /* Get the domain's current policy. */
     nr_msrs = 0;
     nr_cur = nr_leaves;
-    rc = xc_get_domain_cpu_policy(xch, domid, &nr_cur, cur, &nr_msrs, NULL);
+    rc = get_domain_cpu_policy(xch, domid, &nr_cur, cur, &nr_msrs, NULL);
     if ( rc )
     {
         PERROR("Failed to obtain d%d current policy", domid);
@@ -340,10 +340,9 @@ static int xc_cpuid_xend_policy(
     /* Get the domain type's default policy. */
     nr_msrs = 0;
     nr_def = nr_leaves;
-    rc = xc_get_system_cpu_policy(xch,
-                                  di.hvm ? XEN_SYSCTL_cpu_policy_hvm_default
-                                         : XEN_SYSCTL_cpu_policy_pv_default,
-                                  &nr_def, def, &nr_msrs, NULL);
+    rc = get_system_cpu_policy(xch, di.hvm ? XEN_SYSCTL_cpu_policy_hvm_default
+                                           : XEN_SYSCTL_cpu_policy_pv_default,
+                               &nr_def, def, &nr_msrs, NULL);
     if ( rc )
     {
         PERROR("Failed to obtain %s def policy", di.hvm ? "hvm" : "pv");
@@ -354,8 +353,8 @@ static int xc_cpuid_xend_policy(
     /* Get the host policy. */
     nr_msrs = 0;
     nr_host = nr_leaves;
-    rc = xc_get_system_cpu_policy(xch, XEN_SYSCTL_cpu_policy_host,
-                                  &nr_host, host, &nr_msrs, NULL);
+    rc = get_system_cpu_policy(xch, XEN_SYSCTL_cpu_policy_host,
+                               &nr_host, host, &nr_msrs, NULL);
     if ( rc )
     {
         PERROR("Failed to obtain host policy");
@@ -486,9 +485,9 @@ int xc_cpuid_apply_policy(xc_interface *xch, uint32_t domid, bool restore,
 
     /* Get the domain's default policy. */
     nr_msrs = 0;
-    rc = xc_get_system_cpu_policy(xch, di.hvm ? XEN_SYSCTL_cpu_policy_hvm_default
-                                              : XEN_SYSCTL_cpu_policy_pv_default,
-                                  &nr_leaves, leaves, &nr_msrs, NULL);
+    rc = get_system_cpu_policy(xch, di.hvm ? XEN_SYSCTL_cpu_policy_hvm_default
+                                           : XEN_SYSCTL_cpu_policy_pv_default,
+                               &nr_leaves, leaves, &nr_msrs, NULL);
     if ( rc )
     {
         PERROR("Failed to obtain %s default policy", di.hvm ? "hvm" : "pv");
@@ -720,8 +719,8 @@ int xc_cpu_policy_get_system(xc_interface *xch, unsigned int policy_idx,
     unsigned int nr_entries = ARRAY_SIZE(policy->entries);
     int rc;
 
-    rc = xc_get_system_cpu_policy(xch, policy_idx, &nr_leaves, policy->leaves,
-                                  &nr_entries, policy->entries);
+    rc = get_system_cpu_policy(xch, policy_idx, &nr_leaves, policy->leaves,
+                               &nr_entries, policy->entries);
     if ( rc )
     {
         PERROR("Failed to obtain %u policy", policy_idx);
@@ -745,8 +744,8 @@ int xc_cpu_policy_get_domain(xc_interface *xch, uint32_t domid,
     unsigned int nr_entries = ARRAY_SIZE(policy->entries);
     int rc;
 
-    rc = xc_get_domain_cpu_policy(xch, domid, &nr_leaves, policy->leaves,
-                                  &nr_entries, policy->entries);
+    rc = get_domain_cpu_policy(xch, domid, &nr_leaves, policy->leaves,
+                               &nr_entries, policy->entries);
     if ( rc )
     {
         PERROR("Failed to obtain domain %u policy", domid);
diff --git a/tools/libs/guest/xg_sr_common_x86.c b/tools/libs/guest/xg_sr_common_x86.c
index 4982519e05..15265e7a33 100644
--- a/tools/libs/guest/xg_sr_common_x86.c
+++ b/tools/libs/guest/xg_sr_common_x86.c
@@ -48,6 +48,7 @@ int write_x86_cpu_policy_records(struct xc_sr_context *ctx)
     struct xc_sr_record cpuid = { .type = REC_TYPE_X86_CPUID_POLICY, };
     struct xc_sr_record msrs  = { .type = REC_TYPE_X86_MSR_POLICY, };
     uint32_t nr_leaves = 0, nr_msrs = 0;
+    xc_cpu_policy_t policy = NULL;
     int rc;
 
     if ( xc_cpu_policy_get_size(xch, &nr_leaves, &nr_msrs) < 0 )
@@ -58,20 +59,27 @@ int write_x86_cpu_policy_records(struct xc_sr_context *ctx)
 
     cpuid.data = malloc(nr_leaves * sizeof(xen_cpuid_leaf_t));
     msrs.data  = malloc(nr_msrs   * sizeof(xen_msr_entry_t));
-    if ( !cpuid.data || !msrs.data )
+    policy = xc_cpu_policy_init();
+    if ( !cpuid.data || !msrs.data || !policy )
     {
         ERROR("Cannot allocate memory for CPU Policy");
         rc = -1;
         goto out;
     }
 
-    if ( xc_get_domain_cpu_policy(xch, ctx->domid, &nr_leaves, cpuid.data,
-                                  &nr_msrs, msrs.data) )
+    if ( xc_cpu_policy_get_domain(xch, ctx->domid, policy) )
     {
         PERROR("Unable to get d%d CPU Policy", ctx->domid);
         rc = -1;
         goto out;
     }
+    if ( xc_cpu_policy_serialise(xch, policy, cpuid.data, &nr_leaves,
+                                 msrs.data, &nr_msrs) )
+    {
+        PERROR("Unable to serialize d%d CPU Policy", ctx->domid);
+        rc = -1;
+        goto out;
+    }
 
     cpuid.length = nr_leaves * sizeof(xen_cpuid_leaf_t);
     if ( cpuid.length )
@@ -94,6 +102,7 @@ int write_x86_cpu_policy_records(struct xc_sr_context *ctx)
  out:
     free(cpuid.data);
     free(msrs.data);
+    xc_cpu_policy_destroy(policy);
 
     return rc;
 }
diff --git a/tools/misc/xen-cpuid.c b/tools/misc/xen-cpuid.c
index 027b25ad01..b2a36deacc 100644
--- a/tools/misc/xen-cpuid.c
+++ b/tools/misc/xen-cpuid.c
@@ -468,9 +468,12 @@ int main(int argc, char **argv)
         uint32_t i, max_leaves, max_msrs;
 
         xc_interface *xch = xc_interface_open(0, 0, 0);
+        xc_cpu_policy_t policy = xc_cpu_policy_init();
 
         if ( !xch )
             err(1, "xc_interface_open");
+        if ( !policy )
+            err(1, "xc_cpu_policy_init");
 
         if ( xc_cpu_policy_get_size(xch, &max_leaves, &max_msrs) )
             err(1, "xc_get_cpu_policy_size(...)");
@@ -491,10 +494,11 @@ int main(int argc, char **argv)
             uint32_t nr_leaves = max_leaves;
             uint32_t nr_msrs = max_msrs;
 
-            if ( xc_get_domain_cpu_policy(xch, domid, &nr_leaves, leaves,
-                                          &nr_msrs, msrs) )
-                err(1, "xc_get_domain_cpu_policy(, %d, %d,, %d,)",
-                    domid, nr_leaves, nr_msrs);
+            if ( xc_cpu_policy_get_domain(xch, domid, policy) )
+                err(1, "xc_cpu_policy_get_domain(, %d, )", domid);
+            if ( xc_cpu_policy_serialise(xch, policy, leaves, &nr_leaves,
+                                         msrs, &nr_msrs) )
+                err(1, "xc_cpu_policy_serialise");
 
             snprintf(name, sizeof(name), "Domain %d", domid);
             print_policy(name, leaves, nr_leaves, msrs, nr_msrs);
@@ -507,8 +511,7 @@ int main(int argc, char **argv)
                 uint32_t nr_leaves = max_leaves;
                 uint32_t nr_msrs = max_msrs;
 
-                if ( xc_get_system_cpu_policy(xch, i, &nr_leaves, leaves,
-                                              &nr_msrs, msrs) )
+                if ( xc_cpu_policy_get_system(xch, i, policy) )
                 {
                     if ( errno == EOPNOTSUPP )
                     {
@@ -517,14 +520,18 @@ int main(int argc, char **argv)
                         continue;
                     }
 
-                    err(1, "xc_get_system_cpu_policy(, %s,,)", sys_policies[i]);
+                    err(1, "xc_cpu_policy_get_system(, %s, )", sys_policies[i]);
                 }
+                if ( xc_cpu_policy_serialise(xch, policy, leaves, &nr_leaves,
+                                             msrs, &nr_msrs) )
+                    err(1, "xc_cpu_policy_serialise");
 
                 print_policy(sys_policies[i], leaves, nr_leaves,
                              msrs, nr_msrs);
             }
         }
 
+        xc_cpu_policy_destroy(policy);
         free(leaves);
         free(msrs);
         xc_interface_close(xch);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat May 01 01:12:55 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 01 May 2021 01:12:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.120823.228484 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lceBj-0006kr-1V; Sat, 01 May 2021 01:12:55 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 120823.228484; Sat, 01 May 2021 01:12:55 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lceBi-0006ke-Tf; Sat, 01 May 2021 01:12:54 +0000
Received: by outflank-mailman (input) for mailman id 120823;
 Sat, 01 May 2021 01:12:53 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lceBh-0006kJ-Sz
 for xen-changelog@lists.xenproject.org; Sat, 01 May 2021 01:12:53 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lceBh-0004X7-SG
 for xen-changelog@lists.xenproject.org; Sat, 01 May 2021 01:12:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lceBh-00058G-Ra
 for xen-changelog@lists.xenproject.org; Sat, 01 May 2021 01:12:53 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=I8jXT1CvgRyYA2a9aVY3iKwMCa16lxH9XalIGUu7AO0=; b=5uvtY4DI39OJ3qKm0iAB98/5fl
	suMQsCwkjUruqCnq3TYFuaPnperJ4kToUpZFJTfg/Eeo7vXqkN+Ov8dOuDaaZSo7PmFS3yIOntbei
	x6hpQERhrZQaqUQbsRNYOUMLfxRY8YJqrlyy+NAppnLpL4JnbXj4hFubW38yyyP0XvJw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] libs/guest: introduce a helper to apply a cpu policy to a domain
Message-Id: <E1lceBh-00058G-Ra@xenbits.xenproject.org>
Date: Sat, 01 May 2021 01:12:53 +0000

commit 98e67163655a896855fdff1f894b355e57acef2d
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Wed Mar 17 15:30:57 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Apr 29 19:27:21 2021 +0100

    libs/guest: introduce a helper to apply a cpu policy to a domain
    
    Such helper is very similar to the existing xc_set_domain_cpu_policy
    interface, but takes an opaque xc_cpu_policy_t instead of arrays of
    CPUID leaves and MSRs.
    
    No callers of the interface introduced in this patch.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/include/xenctrl.h         |  2 ++
 tools/libs/guest/xg_cpuid_x86.c | 29 +++++++++++++++++++++++++++++
 2 files changed, 31 insertions(+)

diff --git a/tools/include/xenctrl.h b/tools/include/xenctrl.h
index e9a86d63ba..27cec1b93f 100644
--- a/tools/include/xenctrl.h
+++ b/tools/include/xenctrl.h
@@ -2601,6 +2601,8 @@ int xc_cpu_policy_get_system(xc_interface *xch, unsigned int policy_idx,
                              xc_cpu_policy_t policy);
 int xc_cpu_policy_get_domain(xc_interface *xch, uint32_t domid,
                              xc_cpu_policy_t policy);
+int xc_cpu_policy_set_domain(xc_interface *xch, uint32_t domid,
+                             const xc_cpu_policy_t policy);
 
 /* Manipulate a policy via architectural representations. */
 int xc_cpu_policy_serialise(xc_interface *xch, const xc_cpu_policy_t policy,
diff --git a/tools/libs/guest/xg_cpuid_x86.c b/tools/libs/guest/xg_cpuid_x86.c
index bbdabb3a63..0c9b3a960f 100644
--- a/tools/libs/guest/xg_cpuid_x86.c
+++ b/tools/libs/guest/xg_cpuid_x86.c
@@ -762,6 +762,35 @@ int xc_cpu_policy_get_domain(xc_interface *xch, uint32_t domid,
     return rc;
 }
 
+int xc_cpu_policy_set_domain(xc_interface *xch, uint32_t domid,
+                             const xc_cpu_policy_t policy)
+{
+    uint32_t err_leaf = -1, err_subleaf = -1, err_msr = -1;
+    unsigned int nr_leaves = ARRAY_SIZE(policy->leaves);
+    unsigned int nr_entries = ARRAY_SIZE(policy->entries);
+    int rc;
+
+    rc = xc_cpu_policy_serialise(xch, policy, policy->leaves, &nr_leaves,
+                                 policy->entries, &nr_entries);
+    if ( rc )
+        return rc;
+
+    rc = xc_set_domain_cpu_policy(xch, domid, nr_leaves, policy->leaves,
+                                  nr_entries, policy->entries,
+                                  &err_leaf, &err_subleaf, &err_msr);
+    if ( rc )
+    {
+        ERROR("Failed to set domain %u policy (%d = %s)", domid, -rc,
+              strerror(-rc));
+        if ( err_leaf != -1 )
+            ERROR("CPUID leaf %u subleaf %u", err_leaf, err_subleaf);
+        if ( err_msr != -1 )
+            ERROR("MSR index %#x\n", err_msr);
+    }
+
+    return rc;
+}
+
 int xc_cpu_policy_serialise(xc_interface *xch, const xc_cpu_policy_t p,
                             xen_cpuid_leaf_t *leaves, uint32_t *nr_leaves,
                             xen_msr_entry_t *msrs, uint32_t *nr_msrs)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat May 01 01:13:05 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 01 May 2021 01:13:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.120825.228486 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lceBt-0006nj-23; Sat, 01 May 2021 01:13:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 120825.228486; Sat, 01 May 2021 01:13:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lceBs-0006na-VE; Sat, 01 May 2021 01:13:04 +0000
Received: by outflank-mailman (input) for mailman id 120825;
 Sat, 01 May 2021 01:13:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lceBs-0006nI-07
 for xen-changelog@lists.xenproject.org; Sat, 01 May 2021 01:13:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lceBr-0004XR-V7
 for xen-changelog@lists.xenproject.org; Sat, 01 May 2021 01:13:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lceBr-00058x-UQ
 for xen-changelog@lists.xenproject.org; Sat, 01 May 2021 01:13:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=mqWfVWp7cAhjg2369zhC5JvG569+vs5w5zC4yz0iHuw=; b=xVK1kug7kg3E9+buu8kiJp8kiG
	hQrOtC1wbMkKtXv5WKZc/zxvOIexNtMlp+rqPpX+L0RdD1PSdojrTOueDQjFyw8QauuatXujCQwUz
	PGi94aAMbGgixmPFAR9XJ4z+kA63DNow4EMo8B83z6XUSWDZGseCwUfHam//3sFCpnAY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tests/cpu-policy: add sorted MSR test
Message-Id: <E1lceBr-00058x-UQ@xenbits.xenproject.org>
Date: Sat, 01 May 2021 01:13:03 +0000

commit b8e53a81ba538849b98b0d417436f8be653fa1ff
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Tue Apr 13 14:51:44 2021 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Apr 29 19:27:21 2021 +0100

    tests/cpu-policy: add sorted MSR test
    
    Further changes will rely on MSR entries being sorted, so add a test
    to assert it.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/tests/cpu-policy/test-cpu-policy.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/tools/tests/cpu-policy/test-cpu-policy.c b/tools/tests/cpu-policy/test-cpu-policy.c
index cb578ca6e5..75973298df 100644
--- a/tools/tests/cpu-policy/test-cpu-policy.c
+++ b/tools/tests/cpu-policy/test-cpu-policy.c
@@ -89,6 +89,16 @@ static bool leaves_are_sorted(const xen_cpuid_leaf_t *leaves, unsigned int nr)
     return true;
 }
 
+static bool msrs_are_sorted(const xen_msr_entry_t *entries, unsigned int nr)
+{
+    for ( unsigned int i = 1; i < nr; ++i )
+        /* MSR index went backwards => not sorted. */
+        if ( entries[i - 1].idx > entries[i].idx )
+            return false;
+
+    return true;
+}
+
 static void test_cpuid_current(void)
 {
     struct cpuid_policy p;
@@ -273,6 +283,13 @@ static void test_msr_serialise_success(void)
             goto test_done;
         }
 
+        if ( !msrs_are_sorted(msrs, nr) )
+        {
+            fail("  Test %s, MSR entries not sorted\n",
+                 t->name);
+            goto test_done;
+        }
+
     test_done:
         free(msrs);
     }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat May 01 17:11:09 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 01 May 2021 17:11:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.120971.228676 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lct8x-0005CF-Je; Sat, 01 May 2021 17:11:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 120971.228676; Sat, 01 May 2021 17:11:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lct8x-0005C6-GS; Sat, 01 May 2021 17:11:03 +0000
Received: by outflank-mailman (input) for mailman id 120971;
 Sat, 01 May 2021 17:11:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lct8w-0005C1-Ub
 for xen-changelog@lists.xenproject.org; Sat, 01 May 2021 17:11:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lct8w-0001XL-Ot
 for xen-changelog@lists.xenproject.org; Sat, 01 May 2021 17:11:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lct8w-0000qE-OB
 for xen-changelog@lists.xenproject.org; Sat, 01 May 2021 17:11:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=dd9fDS7NFWZx9AAx9gX0b/DIvgR3Zf+TcgtaRSjmaSc=; b=jeGJDh5UrAqeSv5Wyqdi+TptmY
	AJtPd1TMubGDRReTUBtqZuLIqUSBT8fPeqcOb2og0FVRMI4rMmyol/tlbGqaE/sReD1sjgcWqXIBb
	MFyWQoHdTsfKtVKEdY+OFp/oSw6x/ugYxRV1fxjNX+ps9H4jYlFLftXUsMx4VTJlmZVM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86: Always have CR4.PKE set in HVM context
Message-Id: <E1lct8w-0000qE-OB@xenbits.xenproject.org>
Date: Sat, 01 May 2021 17:11:02 +0000

commit 95aaafb5e2a09cad2ab42223e4aa55f88833ef3c
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Apr 29 14:28:43 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Apr 30 17:07:29 2021 +0100

    x86: Always have CR4.PKE set in HVM context
    
    The sole user of read_pkru() is the emulated pagewalk, and guarded behind
    guest_pku_enabled() which restricts the path to HVM (hap, even) context only.
    
    The commentary in read_pkru() concerning _PAGE_GNTTAB overlapping with
    _PAGE_PKEY_BITS is only applicable to PV guests.
    
    The context switch path, via write_ptbase() unconditionally writes CR4 on any
    context switch.
    
    Therefore, we can guarantee to separate CR4.PKE between PV and HVM context at
    no extra cost.  Set PKE in mmu_cr4_features on boot, so it becomes set in HVM
    context, and clear it in pv_make_cr4().
    
    Rename read_pkru() to rdpkru() now that it is a simple wrapper around the
    instruction.  This saves two CR4 writes on every pagewalk, which typically
    occur more than one per emulation.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/mm/guest_walk.c    |  2 +-
 xen/arch/x86/pv/domain.c        | 16 +++++++++++++++-
 xen/arch/x86/setup.c            |  3 +++
 xen/include/asm-x86/processor.h | 10 +---------
 4 files changed, 20 insertions(+), 11 deletions(-)

diff --git a/xen/arch/x86/mm/guest_walk.c b/xen/arch/x86/mm/guest_walk.c
index 1c601314f3..30d83cf1e0 100644
--- a/xen/arch/x86/mm/guest_walk.c
+++ b/xen/arch/x86/mm/guest_walk.c
@@ -416,7 +416,7 @@ guest_walk_tables(const struct vcpu *v, struct p2m_domain *p2m,
          guest_pku_enabled(v) )
     {
         unsigned int pkey = guest_l1e_get_pkey(gw->l1e);
-        unsigned int pkru = read_pkru();
+        unsigned int pkru = rdpkru();
 
         if ( read_pkru_ad(pkru, pkey) ||
              ((walk & PFEC_write_access) && read_pkru_wd(pkru, pkey) &&
diff --git a/xen/arch/x86/pv/domain.c b/xen/arch/x86/pv/domain.c
index f1cb92585e..6ad533183b 100644
--- a/xen/arch/x86/pv/domain.c
+++ b/xen/arch/x86/pv/domain.c
@@ -182,7 +182,21 @@ unsigned long pv_make_cr4(const struct vcpu *v)
 {
     const struct domain *d = v->domain;
     unsigned long cr4 = mmu_cr4_features &
-        ~(X86_CR4_PCIDE | X86_CR4_PGE | X86_CR4_TSD);
+        ~(X86_CR4_PCIDE | X86_CR4_PGE | X86_CR4_TSD | X86_CR4_PKE);
+
+    /*
+     * We want CR4.PKE set in HVM context when available, but don't support it
+     * in PV context at all.
+     *
+     * _PAGE_PKEY_BITS where previously software available PTE bits.  In
+     * principle, we could let an aware PV guest enable PKE.
+     *
+     * However, Xen uses _PAGE_GNTTAB in debug builds which overlaps with
+     * _PAGE_PKEY_BITS, and the ownership of (and eligibility to move)
+     * software PTE bits is not considered in the PV ABI at all.  For now,
+     * punt the problem to whichever unluckly person finds a compelling
+     * usecase for PKRU in PV guests.
+     */
 
     /*
      * PCIDE or PGE depends on the PCID/XPTI settings, but must not both be
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index f2dff2ae6a..8105dc36bb 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -1790,6 +1790,9 @@ void __init noreturn __start_xen(unsigned long mbi_p)
     if ( boot_cpu_has(X86_FEATURE_FSGSBASE) )
         set_in_cr4(X86_CR4_FSGSBASE);
 
+    if ( boot_cpu_has(X86_FEATURE_PKU) )
+        set_in_cr4(X86_CR4_PKE);
+
     if ( opt_invpcid && cpu_has_invpcid )
         use_invpcid = true;
 
diff --git a/xen/include/asm-x86/processor.h b/xen/include/asm-x86/processor.h
index d5f467d245..d8d0dc8034 100644
--- a/xen/include/asm-x86/processor.h
+++ b/xen/include/asm-x86/processor.h
@@ -367,20 +367,12 @@ static always_inline void set_in_cr4 (unsigned long mask)
     write_cr4(read_cr4() | mask);
 }
 
-static inline unsigned int read_pkru(void)
+static inline unsigned int rdpkru(void)
 {
     unsigned int pkru;
-    unsigned long cr4 = read_cr4();
 
-    /*
-     * _PAGE_PKEY_BITS have a conflict with _PAGE_GNTTAB used by PV guests,
-     * so that X86_CR4_PKE  is disabled on hypervisor. To use RDPKRU, CR4.PKE
-     * gets temporarily enabled.
-     */
-    write_cr4(cr4 | X86_CR4_PKE);
     asm volatile (".byte 0x0f,0x01,0xee"
         : "=a" (pkru) : "c" (0) : "dx");
-    write_cr4(cr4);
 
     return pkru;
 }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat May 01 17:11:13 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 01 May 2021 17:11:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.120972.228680 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lct97-0005D1-L4; Sat, 01 May 2021 17:11:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 120972.228680; Sat, 01 May 2021 17:11:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lct97-0005Ct-I8; Sat, 01 May 2021 17:11:13 +0000
Received: by outflank-mailman (input) for mailman id 120972;
 Sat, 01 May 2021 17:11:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lct96-0005Cn-TF
 for xen-changelog@lists.xenproject.org; Sat, 01 May 2021 17:11:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lct96-0001Xc-SN
 for xen-changelog@lists.xenproject.org; Sat, 01 May 2021 17:11:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lct96-0000r2-Rb
 for xen-changelog@lists.xenproject.org; Sat, 01 May 2021 17:11:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=5rSJz4/Legxw5xLpljTze5TIy0+a3c1Mhp9qX1yMhdk=; b=UbGeSzvv1Q2BBwJKPMl2kT9tSQ
	xXVccWGZbWb04mzhk9tvl1SoFsgKolRXIIQGLEa4T2cIxoVSbpmblGlBC82hRuMRcnwcPEfb8TBPX
	uh9ADjm8FE7gremy8RkTaq+aM6PVtGr6aXlWCrT+J3YqtSkXpRbuSEyxrIRZf2e57Z1s=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/hvm: Introduce control register handling for CET
Message-Id: <E1lct96-0000r2-Rb@xenbits.xenproject.org>
Date: Sat, 01 May 2021 17:11:12 +0000

commit 48f2a10a71bb4bc3053142996dd581ebcfa3e3ab
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Apr 21 17:43:56 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Apr 30 17:29:48 2021 +0100

    x86/hvm: Introduce control register handling for CET
    
    Allow CR4.CET to be set, based on the CPUID policy (although these bits are
    not selectable yet for VMs).  CR4.CET needs interlocing with CR0.WP to
    prohibit CET && !WP as a legal combination.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/hvm.c | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index ae37bc434a..28beacc45b 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -976,11 +976,12 @@ const char *hvm_efer_valid(const struct vcpu *v, uint64_t value,
 unsigned long hvm_cr4_guest_valid_bits(const struct domain *d)
 {
     const struct cpuid_policy *p = d->arch.cpuid;
-    bool mce, vmxe;
+    bool mce, vmxe, cet;
 
     /* Logic broken out simply to aid readability below. */
     mce  = p->basic.mce || p->basic.mca;
     vmxe = p->basic.vmx && nestedhvm_enabled(d);
+    cet  = p->feat.cet_ss || p->feat.cet_ibt;
 
     return ((p->basic.vme     ? X86_CR4_VME | X86_CR4_PVI : 0) |
             (p->basic.tsc     ? X86_CR4_TSD               : 0) |
@@ -999,7 +1000,8 @@ unsigned long hvm_cr4_guest_valid_bits(const struct domain *d)
             (p->basic.xsave   ? X86_CR4_OSXSAVE           : 0) |
             (p->feat.smep     ? X86_CR4_SMEP              : 0) |
             (p->feat.smap     ? X86_CR4_SMAP              : 0) |
-            (p->feat.pku      ? X86_CR4_PKE               : 0));
+            (p->feat.pku      ? X86_CR4_PKE               : 0) |
+            (cet              ? X86_CR4_CET               : 0));
 }
 
 static int hvm_load_cpu_ctxt(struct domain *d, hvm_domain_context_t *h)
@@ -2289,6 +2291,12 @@ int hvm_set_cr0(unsigned long value, bool may_defer)
         }
     }
 
+    if ( !(value & X86_CR0_WP) && (v->arch.hvm.guest_cr[4] & X86_CR4_CET) )
+    {
+        gprintk(XENLOG_DEBUG, "Trying to clear WP with CET set\n");
+        return X86EMUL_EXCEPTION;
+    }
+
     if ( (value & X86_CR0_PG) && !(old_value & X86_CR0_PG) )
     {
         if ( v->arch.hvm.guest_efer & EFER_LME )
@@ -2444,6 +2452,12 @@ int hvm_set_cr4(unsigned long value, bool may_defer)
         }
     }
 
+    if ( (value & X86_CR4_CET) && !(v->arch.hvm.guest_cr[0] & X86_CR0_WP) )
+    {
+        gprintk(XENLOG_DEBUG, "Trying to set CET without WP\n");
+        return X86EMUL_EXCEPTION;
+    }
+
     old_cr = v->arch.hvm.guest_cr[4];
 
     if ( (value & X86_CR4_PCIDE) && !(old_cr & X86_CR4_PCIDE) &&
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat May 01 17:11:23 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 01 May 2021 17:11:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.120973.228684 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lct9H-0005ES-Mo; Sat, 01 May 2021 17:11:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 120973.228684; Sat, 01 May 2021 17:11:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lct9H-0005EK-Jl; Sat, 01 May 2021 17:11:23 +0000
Received: by outflank-mailman (input) for mailman id 120973;
 Sat, 01 May 2021 17:11:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lct9H-0005EB-1L
 for xen-changelog@lists.xenproject.org; Sat, 01 May 2021 17:11:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lct9G-0001Xq-W1
 for xen-changelog@lists.xenproject.org; Sat, 01 May 2021 17:11:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lct9G-0000rk-Uj
 for xen-changelog@lists.xenproject.org; Sat, 01 May 2021 17:11:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=yvouMCmgJAk2feCiOM4qqQSx7i2vexDTwzpJ1xuKSGY=; b=oVY3Khku7K2JoD73aYBUkAuOuX
	NTykPgb4YhIkRfhUDiRaLsHudm+6Vw0PGwK3Ix1OSqvhMRzLAlFiefrW6s39giLQNOVGTWUgQ0HdA
	m6saKdaTgcqARAbPdrVPwc02vBCNm0VUrUJRzICWbkgOZwQHr1BvCg76AMkp7z4/FmeM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/svm: Enumeration for CET
Message-Id: <E1lct9G-0000rk-Uj@xenbits.xenproject.org>
Date: Sat, 01 May 2021 17:11:22 +0000

commit 1f8ee4cb430e5a9da37096574c41632cf69a0bc7
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Apr 21 17:43:56 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Apr 30 17:29:48 2021 +0100

    x86/svm: Enumeration for CET
    
    On CET-capable hardware, VMRUN/EXIT unconditionally swaps S_CET, SSP and
    ISST (subject to cleanbits) without further settings.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/svm/svm.c         |  1 +
 xen/arch/x86/hvm/svm/svmdebug.c    |  2 ++
 xen/include/asm-x86/hvm/svm/svm.h  |  2 ++
 xen/include/asm-x86/hvm/svm/vmcb.h | 13 +++++++++++--
 4 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c
index 4585efe1f8..642a64b747 100644
--- a/xen/arch/x86/hvm/svm/svm.c
+++ b/xen/arch/x86/hvm/svm/svm.c
@@ -1658,6 +1658,7 @@ const struct hvm_function_table * __init start_svm(void)
     P(cpu_has_pause_filter, "Pause-Intercept Filter");
     P(cpu_has_pause_thresh, "Pause-Intercept Filter Threshold");
     P(cpu_has_tsc_ratio, "TSC Rate MSR");
+    P(cpu_has_svm_sss, "NPT Supervisor Shadow Stack");
 #undef P
 
     if ( !printed )
diff --git a/xen/arch/x86/hvm/svm/svmdebug.c b/xen/arch/x86/hvm/svm/svmdebug.c
index f450391df4..bce86f0ef7 100644
--- a/xen/arch/x86/hvm/svm/svmdebug.c
+++ b/xen/arch/x86/hvm/svm/svmdebug.c
@@ -82,6 +82,8 @@ void svm_vmcb_dump(const char *from, const struct vmcb_struct *vmcb)
            vmcb->cstar, vmcb->sfmask);
     printk("KernGSBase = 0x%016"PRIx64" PAT = 0x%016"PRIx64"\n",
            vmcb->kerngsbase, vmcb_get_g_pat(vmcb));
+    printk("SSP = 0x%016"PRIx64" S_CET = 0x%016"PRIx64" ISST = 0x%016"PRIx64"\n",
+           vmcb->_ssp, vmcb->_msr_s_cet, vmcb->_msr_isst);
     printk("H_CR3 = 0x%016"PRIx64" CleanBits = %#x\n",
            vmcb_get_h_cr3(vmcb), vmcb->cleanbits.raw);
 
diff --git a/xen/include/asm-x86/hvm/svm/svm.h b/xen/include/asm-x86/hvm/svm/svm.h
index faeca40174..bee939156f 100644
--- a/xen/include/asm-x86/hvm/svm/svm.h
+++ b/xen/include/asm-x86/hvm/svm/svm.h
@@ -75,6 +75,7 @@ extern u32 svm_feature_flags;
 #define SVM_FEATURE_PAUSETHRESH   12 /* Pause intercept filter support */
 #define SVM_FEATURE_VLOADSAVE     15 /* virtual vmload/vmsave */
 #define SVM_FEATURE_VGIF          16 /* Virtual GIF */
+#define SVM_FEATURE_SSS           19 /* NPT Supervisor Shadow Stacks */
 
 #define cpu_has_svm_feature(f) (svm_feature_flags & (1u << (f)))
 #define cpu_has_svm_npt       cpu_has_svm_feature(SVM_FEATURE_NPT)
@@ -89,6 +90,7 @@ extern u32 svm_feature_flags;
 #define cpu_has_pause_thresh  cpu_has_svm_feature(SVM_FEATURE_PAUSETHRESH)
 #define cpu_has_tsc_ratio     cpu_has_svm_feature(SVM_FEATURE_TSCRATEMSR)
 #define cpu_has_svm_vloadsave cpu_has_svm_feature(SVM_FEATURE_VLOADSAVE)
+#define cpu_has_svm_sss       cpu_has_svm_feature(SVM_FEATURE_SSS)
 
 #define SVM_PAUSEFILTER_INIT    4000
 #define SVM_PAUSETHRESH_INIT    1000
diff --git a/xen/include/asm-x86/hvm/svm/vmcb.h b/xen/include/asm-x86/hvm/svm/vmcb.h
index 0b03a8f076..9e1e42f494 100644
--- a/xen/include/asm-x86/hvm/svm/vmcb.h
+++ b/xen/include/asm-x86/hvm/svm/vmcb.h
@@ -248,6 +248,8 @@ enum VMEXIT_EXITCODE
     VMEXIT_EXCEPTION_AC  =  81, /* 0x51, alignment-check */
     VMEXIT_EXCEPTION_MC  =  82, /* 0x52, machine-check */
     VMEXIT_EXCEPTION_XF  =  83, /* 0x53, simd floating-point */
+/*  VMEXIT_EXCEPTION_20  =  84,    0x54, #VE (Intel specific) */
+    VMEXIT_EXCEPTION_CP  =  85, /* 0x55, controlflow protection */
 
     /* exceptions 20-31 (exitcodes 84-95) are reserved */
 
@@ -397,6 +399,8 @@ typedef union
         bool seg:1;        /* 8:  cs, ds, es, ss, cpl */
         bool cr2:1;        /* 9:  cr2 */
         bool lbr:1;        /* 10: debugctlmsr, last{branch,int}{to,from}ip */
+        bool :1;
+        bool cet:1;        /* 12: msr_s_set, ssp, msr_isst */
     };
     uint32_t raw;
 } vmcbcleanbits_t;
@@ -451,7 +455,7 @@ struct vmcb_struct {
             bool _sev_enable    :1;
             bool _sev_es_enable :1;
             bool _gmet          :1;
-            bool                :1;
+            bool _np_sss        :1;
             bool _vte           :1;
         };
         uint64_t _np_ctrl;
@@ -497,7 +501,9 @@ struct vmcb_struct {
     u64 rip;
     u64 res14[11];
     u64 rsp;
-    u64 res15[3];
+    u64 _msr_s_cet;             /* offset 0x400 + 0x1E0 - cleanbit 12 */
+    u64 _ssp;                   /* offset 0x400 + 0x1E8   | */
+    u64 _msr_isst;              /* offset 0x400 + 0x1F0   v */
     u64 rax;
     u64 star;
     u64 lstar;
@@ -635,6 +641,9 @@ VMCB_ACCESSORS(lastbranchfromip, lbr)
 VMCB_ACCESSORS(lastbranchtoip, lbr)
 VMCB_ACCESSORS(lastintfromip, lbr)
 VMCB_ACCESSORS(lastinttoip, lbr)
+VMCB_ACCESSORS(msr_s_cet, cet)
+VMCB_ACCESSORS(ssp, cet)
+VMCB_ACCESSORS(msr_isst, cet)
 
 #undef VMCB_ACCESSORS
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon May 03 13:33:13 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 03 May 2021 13:33:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.121591.229297 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ldYh9-00065i-0b; Mon, 03 May 2021 13:33:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 121591.229297; Mon, 03 May 2021 13:33:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ldYh8-00065a-Ti; Mon, 03 May 2021 13:33:06 +0000
Received: by outflank-mailman (input) for mailman id 121591;
 Mon, 03 May 2021 13:33:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldYh6-00065V-Vw
 for xen-changelog@lists.xenproject.org; Mon, 03 May 2021 13:33:05 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldYh6-0004pk-QJ
 for xen-changelog@lists.xenproject.org; Mon, 03 May 2021 13:33:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldYh6-00047z-On
 for xen-changelog@lists.xenproject.org; Mon, 03 May 2021 13:33:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=bOQij76W7GxkjubMhLI19uWVCzril2kzxKXsUumY2yo=; b=IdfuTLG7hEkZsQznuIc5zrb2wm
	nAwVkwacMGnBO4OMhrw3qcBfaJtTzO9Zeka5bHi7E5oDJjsbsMP7OZKFQPRMwFjNRuavMaTzVS2Jv
	k5cXdstU12VbCa10EDZujy/3+Iq9qaO7flY0DTPTKPtxF0YVJgAjZWx/RBvQmgsYYoW8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/p2m: set_{foreign,mmio}_p2m_entry() are HVM-only
Message-Id: <E1ldYh6-00047z-On@xenbits.xenproject.org>
Date: Mon, 03 May 2021 13:33:04 +0000

commit e7f062e246ad4a4d1baac86fec92fe9fa8aae4d8
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon May 3 15:17:19 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon May 3 15:17:19 2021 +0200

    x86/p2m: set_{foreign,mmio}_p2m_entry() are HVM-only
    
    Extend a respective #ifdef from inside set_typed_p2m_entry() to around
    all three functions. Add ASSERT_UNREACHABLE() to the latter one's safety
    check path.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/mm/p2m.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
index 3840f167b0..3e356418e1 100644
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -1260,6 +1260,8 @@ int p2m_finish_type_change(struct domain *d,
     return rc;
 }
 
+#ifdef CONFIG_HVM
+
 /*
  * Returns:
  *    0              for success
@@ -1280,7 +1282,10 @@ static int set_typed_p2m_entry(struct domain *d, unsigned long gfn_l,
     struct p2m_domain *p2m = p2m_get_hostp2m(d);
 
     if ( !paging_mode_translate(d) )
+    {
+        ASSERT_UNREACHABLE();
         return -EIO;
+    }
 
     gfn_lock(p2m, gfn, order);
     omfn = p2m->get_entry(p2m, gfn, &ot, &a, 0, &cur_order, NULL);
@@ -1313,7 +1318,6 @@ static int set_typed_p2m_entry(struct domain *d, unsigned long gfn_l,
     if ( rc )
         gdprintk(XENLOG_ERR, "p2m_set_entry: %#lx:%u -> %d (0x%"PRI_mfn")\n",
                  gfn_l, order, rc, mfn_x(mfn));
-#ifdef CONFIG_HVM
     else if ( p2m_is_pod(ot) )
     {
         pod_lock(p2m);
@@ -1321,7 +1325,6 @@ static int set_typed_p2m_entry(struct domain *d, unsigned long gfn_l,
         BUG_ON(p2m->pod.entry_count < 0);
         pod_unlock(p2m);
     }
-#endif
     gfn_unlock(p2m, gfn, order);
 
     return rc;
@@ -1349,6 +1352,8 @@ int set_mmio_p2m_entry(struct domain *d, gfn_t gfn, mfn_t mfn,
                                p2m_get_hostp2m(d)->default_access);
 }
 
+#endif /* CONFIG_HVM */
+
 int set_identity_p2m_entry(struct domain *d, unsigned long gfn_l,
                            p2m_access_t p2ma, unsigned int flag)
 {
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon May 03 13:33:17 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 03 May 2021 13:33:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.121592.229301 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ldYhJ-00066R-1x; Mon, 03 May 2021 13:33:17 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 121592.229301; Mon, 03 May 2021 13:33:17 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ldYhI-00066J-VH; Mon, 03 May 2021 13:33:16 +0000
Received: by outflank-mailman (input) for mailman id 121592;
 Mon, 03 May 2021 13:33:15 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldYhH-00066B-2F
 for xen-changelog@lists.xenproject.org; Mon, 03 May 2021 13:33:15 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldYhH-0004pn-0c
 for xen-changelog@lists.xenproject.org; Mon, 03 May 2021 13:33:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldYhG-00048t-Sm
 for xen-changelog@lists.xenproject.org; Mon, 03 May 2021 13:33:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=eK0OMwKj4hfgL2XnJqq1pyjNpR7hBr/RGbxF4r/6IHc=; b=AT42nzJCMnkE6x8f7WB4R6g+o1
	Xboz6HNIdEkFR0zhMZILwLkucmL2ZfID0L9T6Zw97ztVNcYD2hk9MEJfj+dKM7/UD3VKwpE4ntGRw
	Ps7A21L0GMLEmDCmFwBz4D0rRqESqFt+DvVY802QY6b6UfbFiBVqkZbnyWfpqT512/SY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/p2m: {,un}map_mmio_regions() are HVM-only
Message-Id: <E1ldYhG-00048t-Sm@xenbits.xenproject.org>
Date: Mon, 03 May 2021 13:33:14 +0000

commit a4d9fbc0d7b362d3a3d8790958178b2c9c6e2711
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon May 3 15:26:08 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon May 3 15:26:08 2021 +0200

    x86/p2m: {,un}map_mmio_regions() are HVM-only
    
    Mirror the "translated" check the functions do to do_domctl(), allowing
    the calls to be DCEd by the compiler. Add ASSERT_UNREACHABLE() to the
    original checks.
    
    Also arrange for {set,clear}_mmio_p2m_entry() and
    {set,clear}_identity_p2m_entry() to respectively live next to each
    other, such that clear_mmio_p2m_entry() can also be covered by the
    #ifdef already covering set_mmio_p2m_entry().
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/mm/p2m.c     | 106 ++++++++++++++++++++++++----------------------
 xen/common/domctl.c       |   3 ++
 xen/include/asm-x86/p2m.h |   8 ++++
 3 files changed, 67 insertions(+), 50 deletions(-)

diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
index 3e356418e1..e76d8c66d3 100644
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -1352,52 +1352,6 @@ int set_mmio_p2m_entry(struct domain *d, gfn_t gfn, mfn_t mfn,
                                p2m_get_hostp2m(d)->default_access);
 }
 
-#endif /* CONFIG_HVM */
-
-int set_identity_p2m_entry(struct domain *d, unsigned long gfn_l,
-                           p2m_access_t p2ma, unsigned int flag)
-{
-    p2m_type_t p2mt;
-    p2m_access_t a;
-    gfn_t gfn = _gfn(gfn_l);
-    mfn_t mfn;
-    struct p2m_domain *p2m = p2m_get_hostp2m(d);
-    int ret;
-
-    if ( !paging_mode_translate(p2m->domain) )
-    {
-        if ( !is_iommu_enabled(d) )
-            return 0;
-        return iommu_legacy_map(d, _dfn(gfn_l), _mfn(gfn_l),
-                                1ul << PAGE_ORDER_4K,
-                                IOMMUF_readable | IOMMUF_writable);
-    }
-
-    gfn_lock(p2m, gfn, 0);
-
-    mfn = p2m->get_entry(p2m, gfn, &p2mt, &a, 0, NULL, NULL);
-
-    if ( p2mt == p2m_invalid || p2mt == p2m_mmio_dm )
-        ret = p2m_set_entry(p2m, gfn, _mfn(gfn_l), PAGE_ORDER_4K,
-                            p2m_mmio_direct, p2ma);
-    else if ( mfn_x(mfn) == gfn_l && p2mt == p2m_mmio_direct && a == p2ma )
-        ret = 0;
-    else
-    {
-        if ( flag & XEN_DOMCTL_DEV_RDM_RELAXED )
-            ret = 0;
-        else
-            ret = -EBUSY;
-        printk(XENLOG_G_WARNING
-               "Cannot setup identity map d%d:%lx,"
-               " gfn already mapped to %lx.\n",
-               d->domain_id, gfn_l, mfn_x(mfn));
-    }
-
-    gfn_unlock(p2m, gfn, 0);
-    return ret;
-}
-
 /*
  * Returns:
  *    0        for success
@@ -1447,6 +1401,52 @@ int clear_mmio_p2m_entry(struct domain *d, unsigned long gfn_l, mfn_t mfn,
     return rc;
 }
 
+#endif /* CONFIG_HVM */
+
+int set_identity_p2m_entry(struct domain *d, unsigned long gfn_l,
+                           p2m_access_t p2ma, unsigned int flag)
+{
+    p2m_type_t p2mt;
+    p2m_access_t a;
+    gfn_t gfn = _gfn(gfn_l);
+    mfn_t mfn;
+    struct p2m_domain *p2m = p2m_get_hostp2m(d);
+    int ret;
+
+    if ( !paging_mode_translate(p2m->domain) )
+    {
+        if ( !is_iommu_enabled(d) )
+            return 0;
+        return iommu_legacy_map(d, _dfn(gfn_l), _mfn(gfn_l),
+                                1ul << PAGE_ORDER_4K,
+                                IOMMUF_readable | IOMMUF_writable);
+    }
+
+    gfn_lock(p2m, gfn, 0);
+
+    mfn = p2m->get_entry(p2m, gfn, &p2mt, &a, 0, NULL, NULL);
+
+    if ( p2mt == p2m_invalid || p2mt == p2m_mmio_dm )
+        ret = p2m_set_entry(p2m, gfn, _mfn(gfn_l), PAGE_ORDER_4K,
+                            p2m_mmio_direct, p2ma);
+    else if ( mfn_x(mfn) == gfn_l && p2mt == p2m_mmio_direct && a == p2ma )
+        ret = 0;
+    else
+    {
+        if ( flag & XEN_DOMCTL_DEV_RDM_RELAXED )
+            ret = 0;
+        else
+            ret = -EBUSY;
+        printk(XENLOG_G_WARNING
+               "Cannot setup identity map d%d:%lx,"
+               " gfn already mapped to %lx.\n",
+               d->domain_id, gfn_l, mfn_x(mfn));
+    }
+
+    gfn_unlock(p2m, gfn, 0);
+    return ret;
+}
+
 int clear_identity_p2m_entry(struct domain *d, unsigned long gfn_l)
 {
     p2m_type_t p2mt;
@@ -1892,6 +1892,8 @@ void *map_domain_gfn(struct p2m_domain *p2m, gfn_t gfn, mfn_t *mfn,
     return map_domain_page(*mfn);
 }
 
+#ifdef CONFIG_HVM
+
 static unsigned int mmio_order(const struct domain *d,
                                unsigned long start_fn, unsigned long nr)
 {
@@ -1932,7 +1934,10 @@ int map_mmio_regions(struct domain *d,
     unsigned int iter, order;
 
     if ( !paging_mode_translate(d) )
-        return 0;
+    {
+        ASSERT_UNREACHABLE();
+        return -EOPNOTSUPP;
+    }
 
     for ( iter = i = 0; i < nr && iter < MAP_MMIO_MAX_ITER;
           i += 1UL << order, ++iter )
@@ -1964,7 +1969,10 @@ int unmap_mmio_regions(struct domain *d,
     unsigned int iter, order;
 
     if ( !paging_mode_translate(d) )
-        return 0;
+    {
+        ASSERT_UNREACHABLE();
+        return -EOPNOTSUPP;
+    }
 
     for ( iter = i = 0; i < nr && iter < MAP_MMIO_MAX_ITER;
           i += 1UL << order, ++iter )
@@ -1986,8 +1994,6 @@ int unmap_mmio_regions(struct domain *d,
     return i == nr ? 0 : i ?: ret;
 }
 
-#ifdef CONFIG_HVM
-
 int altp2m_get_effective_entry(struct p2m_domain *ap2m, gfn_t gfn, mfn_t *mfn,
                                p2m_type_t *t, p2m_access_t *a,
                                bool prepopulate)
diff --git a/xen/common/domctl.c b/xen/common/domctl.c
index af044e2eda..ef202c2b8c 100644
--- a/xen/common/domctl.c
+++ b/xen/common/domctl.c
@@ -750,6 +750,9 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl)
         if ( ret )
             break;
 
+        if ( !paging_mode_translate(d) )
+            break;
+
         if ( add )
         {
             printk(XENLOG_G_DEBUG
diff --git a/xen/include/asm-x86/p2m.h b/xen/include/asm-x86/p2m.h
index 7d63f5787e..6fadeed7bd 100644
--- a/xen/include/asm-x86/p2m.h
+++ b/xen/include/asm-x86/p2m.h
@@ -658,11 +658,19 @@ int p2m_finish_type_change(struct domain *d,
 int p2m_is_logdirty_range(struct p2m_domain *, unsigned long start,
                           unsigned long end);
 
+#ifdef CONFIG_HVM
 /* Set mmio addresses in the p2m table (for pass-through) */
 int set_mmio_p2m_entry(struct domain *d, gfn_t gfn, mfn_t mfn,
                        unsigned int order);
 int clear_mmio_p2m_entry(struct domain *d, unsigned long gfn, mfn_t mfn,
                          unsigned int order);
+#else
+static inline int clear_mmio_p2m_entry(struct domain *d, unsigned long gfn,
+                                       mfn_t mfn, unsigned int order)
+{
+    return -EIO;
+}
+#endif
 
 /* Set identity addresses in the p2m table (for pass-through) */
 int set_identity_p2m_entry(struct domain *d, unsigned long gfn,
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon May 03 13:33:27 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 03 May 2021 13:33:27 +0000
Received: from list by lists.xenproject.org with outflank-mailman.121593.229304 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ldYhT-00067q-3H; Mon, 03 May 2021 13:33:27 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 121593.229304; Mon, 03 May 2021 13:33:27 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ldYhT-00067i-0U; Mon, 03 May 2021 13:33:27 +0000
Received: by outflank-mailman (input) for mailman id 121593;
 Mon, 03 May 2021 13:33:25 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldYhR-00067Z-55
 for xen-changelog@lists.xenproject.org; Mon, 03 May 2021 13:33:25 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldYhR-0004qC-4I
 for xen-changelog@lists.xenproject.org; Mon, 03 May 2021 13:33:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldYhR-0004Az-3K
 for xen-changelog@lists.xenproject.org; Mon, 03 May 2021 13:33:25 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=KMLyfcYtG+u1KB88O0Ds/Y/17AxwdSe61jBPmgqF1X8=; b=YNgUJ3HBvXzCxRAXesmDWSaEc9
	4ItHett9+BbbiIE5Ribh23yIauILNhPf1ZyQ26F9v6+M6NmRVAgCmjqpNqd641YdKLujTtJK/f6Iu
	g3bBeBExD3RMN2WUFslIbeMfsPa7qKaYc7w6PdNidN+uoaAT5FKwHRNDeVKjIZDnftPo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/mm: the gva_to_gfn() hook is HVM-only
Message-Id: <E1ldYhR-0004Az-3K@xenbits.xenproject.org>
Date: Mon, 03 May 2021 13:33:25 +0000

commit cb117e426f544af6af3e071249a650ecd7f88655
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon May 3 15:27:21 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon May 3 15:27:21 2021 +0200

    x86/mm: the gva_to_gfn() hook is HVM-only
    
    As is the adjacent ga_to_gfn() one as well as paging_gva_to_gfn().
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Tim Deegan <tim@xen.org>
---
 xen/arch/x86/mm/p2m.c          | 3 ++-
 xen/arch/x86/mm/shadow/multi.c | 4 ++++
 xen/arch/x86/mm/shadow/none.c  | 4 ++++
 xen/include/asm-x86/paging.h   | 6 ++++++
 4 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
index e76d8c66d3..7c3a5c8570 100644
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -1793,7 +1793,6 @@ void np2m_schedule(int dir)
         p2m_unlock(p2m);
     }
 }
-#endif
 
 unsigned long paging_gva_to_gfn(struct vcpu *v,
                                 unsigned long va,
@@ -1844,6 +1843,8 @@ unsigned long paging_gva_to_gfn(struct vcpu *v,
     return hostmode->gva_to_gfn(v, hostp2m, va, pfec);
 }
 
+#endif /* CONFIG_HVM */
+
 /*
  * If the map is non-NULL, we leave this function having acquired an extra ref
  * on mfn_to_page(*mfn).  In all cases, *pfec contains appropriate
diff --git a/xen/arch/x86/mm/shadow/multi.c b/xen/arch/x86/mm/shadow/multi.c
index ae65da439f..8bb028c2e2 100644
--- a/xen/arch/x86/mm/shadow/multi.c
+++ b/xen/arch/x86/mm/shadow/multi.c
@@ -3030,6 +3030,7 @@ static bool sh_invlpg(struct vcpu *v, unsigned long linear)
     return true;
 }
 
+#ifdef CONFIG_HVM
 
 static unsigned long
 sh_gva_to_gfn(struct vcpu *v, struct p2m_domain *p2m,
@@ -3063,6 +3064,7 @@ sh_gva_to_gfn(struct vcpu *v, struct p2m_domain *p2m,
     return gfn_x(gfn);
 }
 
+#endif /* CONFIG_HVM */
 
 static inline void
 sh_update_linear_entries(struct vcpu *v)
@@ -4183,7 +4185,9 @@ int sh_audit_l4_table(struct vcpu *v, mfn_t sl4mfn, mfn_t x)
 const struct paging_mode sh_paging_mode = {
     .page_fault                    = sh_page_fault,
     .invlpg                        = sh_invlpg,
+#ifdef CONFIG_HVM
     .gva_to_gfn                    = sh_gva_to_gfn,
+#endif
     .update_cr3                    = sh_update_cr3,
     .update_paging_modes           = shadow_update_paging_modes,
     .flush_tlb                     = shadow_flush_tlb,
diff --git a/xen/arch/x86/mm/shadow/none.c b/xen/arch/x86/mm/shadow/none.c
index 67745074c4..79889b926a 100644
--- a/xen/arch/x86/mm/shadow/none.c
+++ b/xen/arch/x86/mm/shadow/none.c
@@ -43,12 +43,14 @@ static bool _invlpg(struct vcpu *v, unsigned long linear)
     return true;
 }
 
+#ifdef CONFIG_HVM
 static unsigned long _gva_to_gfn(struct vcpu *v, struct p2m_domain *p2m,
                                  unsigned long va, uint32_t *pfec)
 {
     ASSERT_UNREACHABLE();
     return gfn_x(INVALID_GFN);
 }
+#endif
 
 static void _update_cr3(struct vcpu *v, int do_locking, bool noflush)
 {
@@ -63,7 +65,9 @@ static void _update_paging_modes(struct vcpu *v)
 static const struct paging_mode sh_paging_none = {
     .page_fault                    = _page_fault,
     .invlpg                        = _invlpg,
+#ifdef CONFIG_HVM
     .gva_to_gfn                    = _gva_to_gfn,
+#endif
     .update_cr3                    = _update_cr3,
     .update_paging_modes           = _update_paging_modes,
 };
diff --git a/xen/include/asm-x86/paging.h b/xen/include/asm-x86/paging.h
index 7332a9b506..fa22558e2e 100644
--- a/xen/include/asm-x86/paging.h
+++ b/xen/include/asm-x86/paging.h
@@ -127,6 +127,7 @@ struct paging_mode {
                                             struct cpu_user_regs *regs);
     bool          (*invlpg                )(struct vcpu *v,
                                             unsigned long linear);
+#ifdef CONFIG_HVM
     unsigned long (*gva_to_gfn            )(struct vcpu *v,
                                             struct p2m_domain *p2m,
                                             unsigned long va,
@@ -136,6 +137,7 @@ struct paging_mode {
                                             unsigned long cr3,
                                             paddr_t ga, uint32_t *pfec,
                                             unsigned int *page_order);
+#endif
     void          (*update_cr3            )(struct vcpu *v, int do_locking,
                                             bool noflush);
     void          (*update_paging_modes   )(struct vcpu *v);
@@ -287,6 +289,8 @@ unsigned long paging_gva_to_gfn(struct vcpu *v,
                                 unsigned long va,
                                 uint32_t *pfec);
 
+#ifdef CONFIG_HVM
+
 /* Translate a guest address using a particular CR3 value.  This is used
  * to by nested HAP code, to walk the guest-supplied NPT tables as if
  * they were pagetables.
@@ -305,6 +309,8 @@ static inline unsigned long paging_ga_to_gfn_cr3(struct vcpu *v,
         page_order);
 }
 
+#endif /* CONFIG_HVM */
+
 /* Update all the things that are derived from the guest's CR3.
  * Called when the guest changes CR3; the caller can then use v->arch.cr3
  * as the value to load into the host CR3 to schedule this vcpu */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon May 03 13:33:37 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 03 May 2021 13:33:37 +0000
Received: from list by lists.xenproject.org with outflank-mailman.121594.229309 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ldYhd-00069I-4w; Mon, 03 May 2021 13:33:37 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 121594.229309; Mon, 03 May 2021 13:33:37 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ldYhd-00069A-23; Mon, 03 May 2021 13:33:37 +0000
Received: by outflank-mailman (input) for mailman id 121594;
 Mon, 03 May 2021 13:33:35 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldYhb-00068w-8A
 for xen-changelog@lists.xenproject.org; Mon, 03 May 2021 13:33:35 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldYhb-0004qM-7L
 for xen-changelog@lists.xenproject.org; Mon, 03 May 2021 13:33:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldYhb-0004Bg-6Q
 for xen-changelog@lists.xenproject.org; Mon, 03 May 2021 13:33:35 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Q4PzTT7zn/3AmOtLdnngbFokJzz/UWZhp2cvzUBnstc=; b=1NiDuVFQsxxdONdQp1YbGlVFyi
	lQd867BIsQ+mEm3sssJ2cu5OJzbHJz05hbievoynM2PJ5ZiEsePM8s/8rbHdjmKQPU72gQ3zzPfJb
	eU9LQT8L546D00GOoxw35qbb4TAIB7JRUAqTpmiUURp4Tkez8d35lHP9RN0CswAePBHg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] AMD/IOMMU: guest IOMMU support is for HVM only
Message-Id: <E1ldYhb-0004Bg-6Q@xenbits.xenproject.org>
Date: Mon, 03 May 2021 13:33:35 +0000

commit 230a2f68159394b69b35c18844d621e8dcf5b28e
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon May 3 15:27:42 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon May 3 15:27:42 2021 +0200

    AMD/IOMMU: guest IOMMU support is for HVM only
    
    Generally all of this is dead code anyway, but there's a caller of
    guest_iommu_add_ppr_log(), and the code itself calls
    p2m_change_type_one(), which is about to become HVM-only. Hence this
    code, short of deleting it altogether, needs to become properly HVM-
    only as well.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/drivers/passthrough/amd/Makefile | 2 +-
 xen/drivers/passthrough/amd/iommu.h  | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/xen/drivers/passthrough/amd/Makefile b/xen/drivers/passthrough/amd/Makefile
index 95c04ed237..a3aecd26ef 100644
--- a/xen/drivers/passthrough/amd/Makefile
+++ b/xen/drivers/passthrough/amd/Makefile
@@ -5,4 +5,4 @@ obj-y += pci_amd_iommu.o
 obj-bin-y += iommu_acpi.init.o
 obj-y += iommu_intr.o
 obj-y += iommu_cmd.o
-obj-y += iommu_guest.o
+obj-$(CONFIG_HVM) += iommu_guest.o
diff --git a/xen/drivers/passthrough/amd/iommu.h b/xen/drivers/passthrough/amd/iommu.h
index ad089cb095..73f89f0f20 100644
--- a/xen/drivers/passthrough/amd/iommu.h
+++ b/xen/drivers/passthrough/amd/iommu.h
@@ -307,12 +307,16 @@ int __must_check amd_iommu_suspend(void);
 void amd_iommu_crash_shutdown(void);
 
 /* guest iommu support */
+#ifdef CONFIG_HVM
 void amd_iommu_send_guest_cmd(struct amd_iommu *iommu, u32 cmd[]);
 void guest_iommu_add_ppr_log(struct domain *d, u32 entry[]);
 void guest_iommu_add_event_log(struct domain *d, u32 entry[]);
 int guest_iommu_init(struct domain* d);
 void guest_iommu_destroy(struct domain *d);
 int guest_iommu_set_base(struct domain *d, uint64_t base);
+#else
+static inline void guest_iommu_add_ppr_log(struct domain *d, uint32_t entry[]) {}
+#endif
 
 static inline u32 get_field_from_reg_u32(u32 reg_value, u32 mask, u32 shift)
 {
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon May 03 13:33:46 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 03 May 2021 13:33:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.121595.229314 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ldYhm-0006Al-7C; Mon, 03 May 2021 13:33:46 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 121595.229314; Mon, 03 May 2021 13:33:46 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ldYhm-0006Aa-3e; Mon, 03 May 2021 13:33:46 +0000
Received: by outflank-mailman (input) for mailman id 121595;
 Mon, 03 May 2021 13:33:45 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldYhl-0006AU-BZ
 for xen-changelog@lists.xenproject.org; Mon, 03 May 2021 13:33:45 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldYhl-0004qT-Ak
 for xen-changelog@lists.xenproject.org; Mon, 03 May 2021 13:33:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldYhl-0004CU-9t
 for xen-changelog@lists.xenproject.org; Mon, 03 May 2021 13:33:45 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=OAelbPZGRy9CqBbeSm+ahiXJ3AVzEvxvHxC8rnYyq3w=; b=YBcKGTpn777XBDHHFENCegOc40
	YyGhbFK8t1H+Q4y5PbRiZdHyPD6KorERiH5SMHbaj7t+BZFlmRu1ua0bNSRnXXIl1LeG+40OtoRuV
	zJ19x3OsU/0cWzimAKc7kt2nj89EnaSkUk07elxUQZDaWPZiMQD+0i3pjWRntvneM+wc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/p2m: change_entry_type_* hooks are HVM-only
Message-Id: <E1ldYhl-0004CU-9t@xenbits.xenproject.org>
Date: Mon, 03 May 2021 13:33:45 +0000

commit 136234f0da018390c98d4353dfe2f2934b623106
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon May 3 15:27:56 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon May 3 15:27:56 2021 +0200

    x86/p2m: change_entry_type_* hooks are HVM-only
    
    Exclude functions using them from !HVM builds, thus making it possible
    to exclude the hooks as well. Also cover the already unused
    memory_type_changed hook while inserting the #ifdef in the struct.
    
    While no respective check was there, I can't see how
    XEN_DOMCTL_set_broken_page_p2m could have been meant to work for PV the
    way it is implemented. Restrict this operation to acting on HVM guests.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/domctl.c     |  7 +++++--
 xen/arch/x86/mm/p2m-pt.c  |  8 ++++++++
 xen/arch/x86/mm/p2m.c     | 14 +++++++-------
 xen/arch/x86/mm/paging.c  |  2 ++
 xen/include/asm-x86/p2m.h |  2 ++
 5 files changed, 24 insertions(+), 9 deletions(-)

diff --git a/xen/arch/x86/domctl.c b/xen/arch/x86/domctl.c
index e440bd021e..26a76d2be9 100644
--- a/xen/arch/x86/domctl.c
+++ b/xen/arch/x86/domctl.c
@@ -1080,9 +1080,12 @@ long arch_do_domctl(
     {
         p2m_type_t pt;
         unsigned long pfn = domctl->u.set_broken_page_p2m.pfn;
-        mfn_t mfn = get_gfn_query(d, pfn, &pt);
 
-        if ( unlikely(!mfn_valid(mfn)) || unlikely(!p2m_is_ram(pt)) )
+        if ( !is_hvm_domain(d) )
+            return -EINVAL;
+
+        if ( unlikely(!mfn_valid(get_gfn_query(d, pfn, &pt))) ||
+             unlikely(!p2m_is_ram(pt)) )
             ret = -EINVAL;
         else
             ret = p2m_change_type_one(d, pfn, pt, p2m_ram_broken);
diff --git a/xen/arch/x86/mm/p2m-pt.c b/xen/arch/x86/mm/p2m-pt.c
index f2afcf49a3..4a70ee4f19 100644
--- a/xen/arch/x86/mm/p2m-pt.c
+++ b/xen/arch/x86/mm/p2m-pt.c
@@ -324,6 +324,7 @@ p2m_next_level(struct p2m_domain *p2m, void **table,
     return rc;
 }
 
+#ifdef CONFIG_HVM
 /*
  * Mark (via clearing the U flag) as needing P2M type re-calculation all valid
  * present entries at the targeted level for the passed in GFN range, which is
@@ -392,6 +393,7 @@ static int p2m_pt_set_recalc_range(struct p2m_domain *p2m,
 
     return err;
 }
+#endif /* CONFIG_HVM */
 
 /*
  * Handle possibly necessary P2M type re-calculation (U flag clear for a
@@ -930,6 +932,8 @@ pod_retry_l1:
     return (p2m_is_valid(*t) || p2m_is_any_ram(*t)) ? mfn : INVALID_MFN;
 }
 
+#ifdef CONFIG_HVM
+
 static void p2m_pt_change_entry_type_global(struct p2m_domain *p2m,
                                             p2m_type_t ot, p2m_type_t nt)
 {
@@ -1011,6 +1015,8 @@ static int p2m_pt_change_entry_type_range(struct p2m_domain *p2m,
     return err;
 }
 
+#endif /* CONFIG_HVM */
+
 #if P2M_AUDIT
 static long p2m_pt_audit_p2m(struct p2m_domain *p2m)
 {
@@ -1168,8 +1174,10 @@ void p2m_pt_init(struct p2m_domain *p2m)
     p2m->set_entry = p2m_pt_set_entry;
     p2m->get_entry = p2m_pt_get_entry;
     p2m->recalc = do_recalc;
+#ifdef CONFIG_HVM
     p2m->change_entry_type_global = p2m_pt_change_entry_type_global;
     p2m->change_entry_type_range = p2m_pt_change_entry_type_range;
+#endif
 
     /* Still too early to use paging_mode_hap(). */
     if ( hap_enabled(p2m->domain) )
diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
index 7c3a5c8570..bb3ac9c81e 100644
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -292,6 +292,8 @@ int p2m_is_logdirty_range(struct p2m_domain *p2m, unsigned long start,
     return 0;
 }
 
+#ifdef CONFIG_HVM
+
 static void change_entry_type_global(struct p2m_domain *p2m,
                                      p2m_type_t ot, p2m_type_t nt)
 {
@@ -316,7 +318,6 @@ void p2m_change_entry_type_global(struct domain *d,
 
     change_entry_type_global(hostp2m, ot, nt);
 
-#ifdef CONFIG_HVM
     if ( unlikely(altp2m_active(d)) )
     {
         unsigned int i;
@@ -331,12 +332,10 @@ void p2m_change_entry_type_global(struct domain *d,
                 p2m_unlock(altp2m);
             }
     }
-#endif
 
     p2m_unlock(hostp2m);
 }
 
-#ifdef CONFIG_HVM
 /* There's already a memory_type_changed() in asm/mtrr.h. */
 static void _memory_type_changed(struct p2m_domain *p2m)
 {
@@ -369,7 +368,8 @@ void p2m_memory_type_changed(struct domain *d)
 
     p2m_unlock(hostp2m);
 }
-#endif
+
+#endif /* CONFIG_HVM */
 
 int p2m_set_ioreq_server(struct domain *d,
                          unsigned int flags,
@@ -876,6 +876,7 @@ guest_physmap_add_page(struct domain *d, gfn_t gfn, mfn_t mfn,
 }
 
 #ifdef CONFIG_HVM
+
 int
 guest_physmap_add_entry(struct domain *d, gfn_t gfn, mfn_t mfn,
                         unsigned int page_order, p2m_type_t t)
@@ -1024,7 +1025,6 @@ out:
 
     return rc;
 }
-#endif
 
 /*
  * Modify the p2m type of a single gfn from ot to nt.
@@ -1161,7 +1161,6 @@ void p2m_change_type_range(struct domain *d,
 
     change_type_range(hostp2m, start, end, ot, nt);
 
-#ifdef CONFIG_HVM
     if ( unlikely(altp2m_active(d)) )
     {
         unsigned int i;
@@ -1176,7 +1175,6 @@ void p2m_change_type_range(struct domain *d,
                 p2m_unlock(altp2m);
             }
     }
-#endif
     hostp2m->defer_nested_flush = 0;
     if ( nestedhvm_enabled(d) )
         p2m_flush_nestedp2m(d);
@@ -1184,6 +1182,8 @@ void p2m_change_type_range(struct domain *d,
     p2m_unlock(hostp2m);
 }
 
+#endif /* CONFIG_HVM */
+
 /*
  * Finish p2m type change for gfns which are marked as need_recalc in a range.
  * Uses the current p2m's max_mapped_pfn to further clip the invalidation
diff --git a/xen/arch/x86/mm/paging.c b/xen/arch/x86/mm/paging.c
index 8bc14df943..c304c24526 100644
--- a/xen/arch/x86/mm/paging.c
+++ b/xen/arch/x86/mm/paging.c
@@ -588,6 +588,7 @@ static int paging_log_dirty_op(struct domain *d,
     return rv;
 }
 
+#ifdef CONFIG_HVM
 void paging_log_dirty_range(struct domain *d,
                            unsigned long begin_pfn,
                            unsigned long nr,
@@ -617,6 +618,7 @@ void paging_log_dirty_range(struct domain *d,
 
     guest_flush_tlb_mask(d, d->dirty_cpumask);
 }
+#endif
 
 /*
  * Callers must supply log_dirty_ops for the log dirty code to call. This
diff --git a/xen/include/asm-x86/p2m.h b/xen/include/asm-x86/p2m.h
index 6fadeed7bd..1084397ffe 100644
--- a/xen/include/asm-x86/p2m.h
+++ b/xen/include/asm-x86/p2m.h
@@ -264,6 +264,7 @@ struct p2m_domain {
     void               (*enable_hardware_log_dirty)(struct p2m_domain *p2m);
     void               (*disable_hardware_log_dirty)(struct p2m_domain *p2m);
     void               (*flush_hardware_cached_dirty)(struct p2m_domain *p2m);
+#ifdef CONFIG_HVM
     void               (*change_entry_type_global)(struct p2m_domain *p2m,
                                                    p2m_type_t ot,
                                                    p2m_type_t nt);
@@ -272,6 +273,7 @@ struct p2m_domain {
                                                   unsigned long first_gfn,
                                                   unsigned long last_gfn);
     void               (*memory_type_changed)(struct p2m_domain *p2m);
+#endif
     void               (*write_p2m_entry_pre)(struct domain *d,
                                               unsigned long gfn,
                                               l1_pgentry_t old,
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon May 03 13:33:56 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 03 May 2021 13:33:56 +0000
Received: from list by lists.xenproject.org with outflank-mailman.121596.229319 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ldYhw-0006CK-A1; Mon, 03 May 2021 13:33:56 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 121596.229319; Mon, 03 May 2021 13:33:56 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ldYhw-0006CC-6c; Mon, 03 May 2021 13:33:56 +0000
Received: by outflank-mailman (input) for mailman id 121596;
 Mon, 03 May 2021 13:33:55 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldYhv-0006C4-En
 for xen-changelog@lists.xenproject.org; Mon, 03 May 2021 13:33:55 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldYhv-0004qi-Dz
 for xen-changelog@lists.xenproject.org; Mon, 03 May 2021 13:33:55 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldYhv-0004D8-D7
 for xen-changelog@lists.xenproject.org; Mon, 03 May 2021 13:33:55 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Ly6r+a7IfxXIJ+jrWDsa67lypKe1UCbgSgrjxZB9iLw=; b=iB7qKXGtC2NqamI48W/xMhxcxp
	/Znnmp7bwZ7dVqEQn8mpX/bpDzzLh1BVSw0F0sY9OgUdkshUsWdHuizWIuac+qd2qFg9+GS/FH6tF
	WCyFIuemjdRCqe6MrCVZxrf+ahNlvj2gVExKwWq6s6yhvTCtX8NxTe/L5B6XqGYzGCVM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/p2m: hardware-log-dirty related hooks are HVM-only
Message-Id: <E1ldYhv-0004D8-D7@xenbits.xenproject.org>
Date: Mon, 03 May 2021 13:33:55 +0000

commit 594b263511687d27f1492f1277da729a2cc8f024
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon May 3 15:28:16 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon May 3 15:28:16 2021 +0200

    x86/p2m: hardware-log-dirty related hooks are HVM-only
    
    Exclude functions using them from !HVM builds, thus making it possible
    to exclude the hooks as well.
    
    By moving an #endif in p2m.c (instead of introducing yet another one)
    p2m_{get,set}_ioreq_server() get excluded for !HVM builds as well.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/mm/p2m.c     |  4 ++--
 xen/include/asm-x86/p2m.h | 11 ++++++++++-
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
index bb3ac9c81e..0e469369b9 100644
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -369,8 +369,6 @@ void p2m_memory_type_changed(struct domain *d)
     p2m_unlock(hostp2m);
 }
 
-#endif /* CONFIG_HVM */
-
 int p2m_set_ioreq_server(struct domain *d,
                          unsigned int flags,
                          struct ioreq_server *s)
@@ -464,6 +462,8 @@ void p2m_flush_hardware_cached_dirty(struct domain *d)
     }
 }
 
+#endif /* CONFIG_HVM */
+
 /*
  * Force a synchronous P2M TLB flush if a deferred flush is pending.
  *
diff --git a/xen/include/asm-x86/p2m.h b/xen/include/asm-x86/p2m.h
index 1084397ffe..1ed7da9473 100644
--- a/xen/include/asm-x86/p2m.h
+++ b/xen/include/asm-x86/p2m.h
@@ -261,10 +261,10 @@ struct p2m_domain {
                                     bool_t *sve);
     int                (*recalc)(struct p2m_domain *p2m,
                                  unsigned long gfn);
+#ifdef CONFIG_HVM
     void               (*enable_hardware_log_dirty)(struct p2m_domain *p2m);
     void               (*disable_hardware_log_dirty)(struct p2m_domain *p2m);
     void               (*flush_hardware_cached_dirty)(struct p2m_domain *p2m);
-#ifdef CONFIG_HVM
     void               (*change_entry_type_global)(struct p2m_domain *p2m,
                                                    p2m_type_t ot,
                                                    p2m_type_t nt);
@@ -630,6 +630,9 @@ int guest_physmap_add_page(struct domain *d, gfn_t gfn, mfn_t mfn,
 /* Set a p2m range as populate-on-demand */
 int guest_physmap_mark_populate_on_demand(struct domain *d, unsigned long gfn,
                                           unsigned int order);
+
+#ifdef CONFIG_HVM
+
 /* Enable hardware-assisted log-dirty. */
 void p2m_enable_hardware_log_dirty(struct domain *d);
 
@@ -639,6 +642,12 @@ void p2m_disable_hardware_log_dirty(struct domain *d);
 /* Flush hardware cached dirty GFNs */
 void p2m_flush_hardware_cached_dirty(struct domain *d);
 
+#else
+
+static inline void p2m_flush_hardware_cached_dirty(struct domain *d) {}
+
+#endif
+
 /* Change types across all p2m entries in a domain */
 void p2m_change_entry_type_global(struct domain *d, 
                                   p2m_type_t ot, p2m_type_t nt);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon May 03 13:34:06 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 03 May 2021 13:34:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.121597.229321 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ldYi6-0006Da-BT; Mon, 03 May 2021 13:34:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 121597.229321; Mon, 03 May 2021 13:34:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ldYi6-0006DS-8A; Mon, 03 May 2021 13:34:06 +0000
Received: by outflank-mailman (input) for mailman id 121597;
 Mon, 03 May 2021 13:34:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldYi5-0006DK-IN
 for xen-changelog@lists.xenproject.org; Mon, 03 May 2021 13:34:05 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldYi5-0004r4-HU
 for xen-changelog@lists.xenproject.org; Mon, 03 May 2021 13:34:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldYi5-0004Dw-Gb
 for xen-changelog@lists.xenproject.org; Mon, 03 May 2021 13:34:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=mh50LwzXPGgHhZ2wAuZhw6w4PmnlaBqfQMnisx08oSY=; b=FMbhTGa8HRnGdVh0cpdDIKMVun
	R/6KQ3r/tdLUo3IEhOWjD48lAW4pJR5jYa0G/X0NK80ICShVpF72p0ngdwTyxdSBV7OoayDnYrq+c
	nzSD/lwmh/3iE3lBpUImQoRWfXfvJ9fMFLhhJWggeXMRvOoJ9nR5HcWtAapHYkh+GpFc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/p2m: the recalc hook is HVM-only
Message-Id: <E1ldYi5-0004Dw-Gb@xenbits.xenproject.org>
Date: Mon, 03 May 2021 13:34:05 +0000

commit ab305d365550a1cd91e58f8a9ff52b980f813380
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon May 3 15:28:33 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon May 3 15:28:33 2021 +0200

    x86/p2m: the recalc hook is HVM-only
    
    Exclude functions involved in its use from !HVM builds, thus making it
    possible to exclude the hook as well.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/mm/p2m-pt.c  | 2 +-
 xen/arch/x86/mm/p2m.c     | 6 ------
 xen/include/asm-x86/p2m.h | 2 +-
 3 files changed, 2 insertions(+), 8 deletions(-)

diff --git a/xen/arch/x86/mm/p2m-pt.c b/xen/arch/x86/mm/p2m-pt.c
index 4a70ee4f19..efbe5fd195 100644
--- a/xen/arch/x86/mm/p2m-pt.c
+++ b/xen/arch/x86/mm/p2m-pt.c
@@ -1173,8 +1173,8 @@ void p2m_pt_init(struct p2m_domain *p2m)
 {
     p2m->set_entry = p2m_pt_set_entry;
     p2m->get_entry = p2m_pt_get_entry;
-    p2m->recalc = do_recalc;
 #ifdef CONFIG_HVM
+    p2m->recalc = do_recalc;
     p2m->change_entry_type_global = p2m_pt_change_entry_type_global;
     p2m->change_entry_type_range = p2m_pt_change_entry_type_range;
 #endif
diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
index 0e469369b9..ad388e0802 100644
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -1182,8 +1182,6 @@ void p2m_change_type_range(struct domain *d,
     p2m_unlock(hostp2m);
 }
 
-#endif /* CONFIG_HVM */
-
 /*
  * Finish p2m type change for gfns which are marked as need_recalc in a range.
  * Uses the current p2m's max_mapped_pfn to further clip the invalidation
@@ -1234,7 +1232,6 @@ int p2m_finish_type_change(struct domain *d,
     if ( rc < 0 )
         goto out;
 
-#ifdef CONFIG_HVM
     if ( unlikely(altp2m_active(d)) )
     {
         unsigned int i;
@@ -1252,7 +1249,6 @@ int p2m_finish_type_change(struct domain *d,
                     goto out;
             }
     }
-#endif
 
  out:
     p2m_unlock(hostp2m);
@@ -1260,8 +1256,6 @@ int p2m_finish_type_change(struct domain *d,
     return rc;
 }
 
-#ifdef CONFIG_HVM
-
 /*
  * Returns:
  *    0              for success
diff --git a/xen/include/asm-x86/p2m.h b/xen/include/asm-x86/p2m.h
index 1ed7da9473..979fc83d02 100644
--- a/xen/include/asm-x86/p2m.h
+++ b/xen/include/asm-x86/p2m.h
@@ -259,9 +259,9 @@ struct p2m_domain {
                                     p2m_query_t q,
                                     unsigned int *page_order,
                                     bool_t *sve);
+#ifdef CONFIG_HVM
     int                (*recalc)(struct p2m_domain *p2m,
                                  unsigned long gfn);
-#ifdef CONFIG_HVM
     void               (*enable_hardware_log_dirty)(struct p2m_domain *p2m);
     void               (*disable_hardware_log_dirty)(struct p2m_domain *p2m);
     void               (*flush_hardware_cached_dirty)(struct p2m_domain *p2m);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon May 03 13:34:16 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 03 May 2021 13:34:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.121598.229326 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ldYiG-0006Et-D9; Mon, 03 May 2021 13:34:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 121598.229326; Mon, 03 May 2021 13:34:16 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ldYiG-0006Ei-9i; Mon, 03 May 2021 13:34:16 +0000
Received: by outflank-mailman (input) for mailman id 121598;
 Mon, 03 May 2021 13:34:15 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldYiF-0006Eb-N5
 for xen-changelog@lists.xenproject.org; Mon, 03 May 2021 13:34:15 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldYiF-0004rC-MF
 for xen-changelog@lists.xenproject.org; Mon, 03 May 2021 13:34:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldYiF-0004Ev-Kj
 for xen-changelog@lists.xenproject.org; Mon, 03 May 2021 13:34:15 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=fIcp68Bvw2vp7JXDc8kVjmGlG5V909MIytT3MUUSyeM=; b=TG0IzD8O02SaGM48c25JDfesp7
	5L2UKbPXpHUs0eBkxa7yn98B49eBXaJPNrNieyt4+2M3l+2OlWDhajQdTK9EPvFsPMrwFhyd1xNo7
	GRxUokhWQbnDCJ5Jg1TLwR5saPtXtycint+71VsRmwld/+IWnfcg5WmZcHaQxoFsP9FQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86: make mem-paging configurable and default it to off
Message-Id: <E1ldYiF-0004Ev-Kj@xenbits.xenproject.org>
Date: Mon, 03 May 2021 13:34:15 +0000

commit 936830c99dad6de757f5153206ccd334cc950bb2
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon May 3 15:28:53 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon May 3 15:28:53 2021 +0200

    x86: make mem-paging configurable and default it to off
    
    ... for being unsupported.
    
    While doing so, make the option dependent upon HVM, which really is the
    main purpose of the change.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Alexandru Isaila <aisaila@bitdefender.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/Kconfig                | 5 ++++-
 xen/arch/x86/hvm/hvm.c              | 2 ++
 xen/arch/x86/mm/Makefile            | 2 +-
 xen/arch/x86/x86_64/compat/mm.c     | 2 ++
 xen/arch/x86/x86_64/mm.c            | 2 ++
 xen/common/Kconfig                  | 3 ---
 xen/common/domain.c                 | 2 +-
 xen/common/memory.c                 | 2 +-
 xen/common/vm_event.c               | 8 ++++----
 xen/drivers/passthrough/x86/iommu.c | 3 ++-
 xen/include/asm-x86/mem_paging.h    | 6 ++++++
 xen/include/asm-x86/p2m.h           | 5 +++++
 xen/include/xen/sched.h             | 2 +-
 xen/include/xsm/dummy.h             | 2 +-
 xen/include/xsm/xsm.h               | 4 ++--
 xen/xsm/dummy.c                     | 2 +-
 xen/xsm/flask/hooks.c               | 4 ++--
 17 files changed, 37 insertions(+), 19 deletions(-)

diff --git a/xen/arch/x86/Kconfig b/xen/arch/x86/Kconfig
index 32b9f23a20..271b098fb5 100644
--- a/xen/arch/x86/Kconfig
+++ b/xen/arch/x86/Kconfig
@@ -16,7 +16,6 @@ config X86
 	select HAS_FAST_MULTIPLY
 	select HAS_IOPORTS
 	select HAS_KEXEC
-	select HAS_MEM_PAGING
 	select HAS_NS16550
 	select HAS_PASSTHROUGH
 	select HAS_PCI
@@ -255,6 +254,10 @@ config HYPERV_GUEST
 
 endif
 
+config MEM_PAGING
+	bool "Xen memory paging support (UNSUPPORTED)" if UNSUPPORTED
+	depends on HVM
+
 config MEM_SHARING
 	bool "Xen memory sharing support (UNSUPPORTED)" if UNSUPPORTED
 	depends on HVM
diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 28beacc45b..5086773e5c 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -1934,9 +1934,11 @@ int hvm_hap_nested_page_fault(paddr_t gpa, unsigned long gla,
         goto out_put_gfn;
     }
 
+#ifdef CONFIG_MEM_PAGING
     /* Check if the page has been paged out */
     if ( p2m_is_paged(p2mt) || (p2mt == p2m_ram_paging_out) )
         paged = 1;
+#endif
 
 #ifdef CONFIG_MEM_SHARING
     /* Mem sharing: if still shared on write access then its enomem */
diff --git a/xen/arch/x86/mm/Makefile b/xen/arch/x86/mm/Makefile
index 24f4ec40e0..5cc70005c9 100644
--- a/xen/arch/x86/mm/Makefile
+++ b/xen/arch/x86/mm/Makefile
@@ -5,7 +5,7 @@ obj-$(CONFIG_HVM) += altp2m.o
 obj-$(CONFIG_HVM) += guest_walk_2.o guest_walk_3.o guest_walk_4.o
 obj-$(CONFIG_SHADOW_PAGING) += guest_walk_4.o
 obj-$(CONFIG_MEM_ACCESS) += mem_access.o
-obj-y += mem_paging.o
+obj-$(CONFIG_MEM_PAGING) += mem_paging.o
 obj-$(CONFIG_MEM_SHARING) += mem_sharing.o
 obj-y += p2m.o p2m-pt.o
 obj-$(CONFIG_HVM) += p2m-ept.o p2m-pod.o
diff --git a/xen/arch/x86/x86_64/compat/mm.c b/xen/arch/x86/x86_64/compat/mm.c
index febdaa1977..215e96aba0 100644
--- a/xen/arch/x86/x86_64/compat/mm.c
+++ b/xen/arch/x86/x86_64/compat/mm.c
@@ -155,8 +155,10 @@ int compat_arch_memory_op(unsigned long cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
     case XENMEM_get_sharing_shared_pages:
         return mem_sharing_get_nr_shared_mfns();
 
+#ifdef CONFIG_MEM_PAGING
     case XENMEM_paging_op:
         return mem_paging_memop(guest_handle_cast(arg, xen_mem_paging_op_t));
+#endif
 
 #ifdef CONFIG_MEM_SHARING
     case XENMEM_sharing_op:
diff --git a/xen/arch/x86/x86_64/mm.c b/xen/arch/x86/x86_64/mm.c
index c41ce847b3..4f225da81e 100644
--- a/xen/arch/x86/x86_64/mm.c
+++ b/xen/arch/x86/x86_64/mm.c
@@ -1008,8 +1008,10 @@ long subarch_memory_op(unsigned long cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
     case XENMEM_get_sharing_shared_pages:
         return mem_sharing_get_nr_shared_mfns();
 
+#ifdef CONFIG_MEM_PAGING
     case XENMEM_paging_op:
         return mem_paging_memop(guest_handle_cast(arg, xen_mem_paging_op_t));
+#endif
 
 #ifdef CONFIG_MEM_SHARING
     case XENMEM_sharing_op:
diff --git a/xen/common/Kconfig b/xen/common/Kconfig
index b6c9827a7b..0ddd18e11a 100644
--- a/xen/common/Kconfig
+++ b/xen/common/Kconfig
@@ -43,9 +43,6 @@ config HAS_IOPORTS
 config HAS_KEXEC
 	bool
 
-config HAS_MEM_PAGING
-	bool
-
 config HAS_PDX
 	bool
 
diff --git a/xen/common/domain.c b/xen/common/domain.c
index cdda0d1f29..6b71c6d6a9 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -1096,7 +1096,7 @@ static void complete_domain_destroy(struct rcu_head *head)
     free_xenoprof_pages(d);
 #endif
 
-#ifdef CONFIG_HAS_MEM_PAGING
+#ifdef CONFIG_MEM_PAGING
     xfree(d->vm_event_paging);
 #endif
     xfree(d->vm_event_monitor);
diff --git a/xen/common/memory.c b/xen/common/memory.c
index 76b9f58478..b5c70c4b85 100644
--- a/xen/common/memory.c
+++ b/xen/common/memory.c
@@ -1856,7 +1856,7 @@ int check_get_page_from_gfn(struct domain *d, gfn_t gfn, bool readonly,
 
     page = get_page_from_gfn(d, gfn_x(gfn), &p2mt, q);
 
-#ifdef CONFIG_HAS_MEM_PAGING
+#ifdef CONFIG_MEM_PAGING
     if ( p2m_is_paging(p2mt) )
     {
         if ( page )
diff --git a/xen/common/vm_event.c b/xen/common/vm_event.c
index 44d542f23e..70ab3ba406 100644
--- a/xen/common/vm_event.c
+++ b/xen/common/vm_event.c
@@ -390,7 +390,7 @@ static int vm_event_resume(struct domain *d, struct vm_event_domain *ved)
         /* Check flags which apply only when the vCPU is paused */
         if ( atomic_read(&v->vm_event_pause_count) )
         {
-#ifdef CONFIG_HAS_MEM_PAGING
+#ifdef CONFIG_MEM_PAGING
             if ( rsp.reason == VM_EVENT_REASON_MEM_PAGING )
                 p2m_mem_paging_resume(d, &rsp);
 #endif
@@ -521,7 +521,7 @@ int __vm_event_claim_slot(struct domain *d, struct vm_event_domain *ved,
         return vm_event_grab_slot(ved, current->domain != d);
 }
 
-#ifdef CONFIG_HAS_MEM_PAGING
+#ifdef CONFIG_MEM_PAGING
 /* Registered with Xen-bound event channel for incoming notifications. */
 static void mem_paging_notification(struct vcpu *v, unsigned int port)
 {
@@ -546,7 +546,7 @@ static void mem_sharing_notification(struct vcpu *v, unsigned int port)
 /* Clean up on domain destruction */
 void vm_event_cleanup(struct domain *d)
 {
-#ifdef CONFIG_HAS_MEM_PAGING
+#ifdef CONFIG_MEM_PAGING
     if ( vm_event_check_ring(d->vm_event_paging) )
     {
         /* Destroying the wait queue head means waking up all
@@ -613,7 +613,7 @@ int vm_event_domctl(struct domain *d, struct xen_domctl_vm_event_op *vec)
 
     switch ( vec->mode )
     {
-#ifdef CONFIG_HAS_MEM_PAGING
+#ifdef CONFIG_MEM_PAGING
     case XEN_DOMCTL_VM_EVENT_OP_PAGING:
     {
         rc = -EINVAL;
diff --git a/xen/drivers/passthrough/x86/iommu.c b/xen/drivers/passthrough/x86/iommu.c
index b90bb31bfe..593cc4d6ae 100644
--- a/xen/drivers/passthrough/x86/iommu.c
+++ b/xen/drivers/passthrough/x86/iommu.c
@@ -23,6 +23,7 @@
 
 #include <asm/hvm/io.h>
 #include <asm/io_apic.h>
+#include <asm/mem_paging.h>
 #include <asm/setup.h>
 
 const struct iommu_init_ops *__initdata iommu_init_ops;
@@ -336,7 +337,7 @@ bool arch_iommu_use_permitted(const struct domain *d)
      */
     return d == dom_io ||
            (likely(!mem_sharing_enabled(d)) &&
-            likely(!vm_event_check_ring(d->vm_event_paging)) &&
+            likely(!mem_paging_enabled(d)) &&
             likely(!p2m_get_hostp2m(d)->global_logdirty));
 }
 
diff --git a/xen/include/asm-x86/mem_paging.h b/xen/include/asm-x86/mem_paging.h
index 176acafc75..d3635e96cf 100644
--- a/xen/include/asm-x86/mem_paging.h
+++ b/xen/include/asm-x86/mem_paging.h
@@ -24,6 +24,12 @@
 
 int mem_paging_memop(XEN_GUEST_HANDLE_PARAM(xen_mem_paging_op_t) arg);
 
+#ifdef CONFIG_MEM_PAGING
+# define mem_paging_enabled(d) vm_event_check_ring((d)->vm_event_paging)
+#else
+# define mem_paging_enabled(d) false
+#endif
+
 #endif /*__ASM_X86_MEM_PAGING_H__ */
 
 /*
diff --git a/xen/include/asm-x86/p2m.h b/xen/include/asm-x86/p2m.h
index 979fc83d02..b7da310f70 100644
--- a/xen/include/asm-x86/p2m.h
+++ b/xen/include/asm-x86/p2m.h
@@ -136,11 +136,16 @@ typedef unsigned int p2m_query_t;
 #define P2M_PAGEABLE_TYPES (p2m_to_mask(p2m_ram_rw) \
                             | p2m_to_mask(p2m_ram_logdirty) )
 
+#ifdef CONFIG_MEM_PAGING
 #define P2M_PAGING_TYPES (p2m_to_mask(p2m_ram_paging_out)        \
                           | p2m_to_mask(p2m_ram_paged)           \
                           | p2m_to_mask(p2m_ram_paging_in))
 
 #define P2M_PAGED_TYPES (p2m_to_mask(p2m_ram_paged))
+#else
+#define P2M_PAGING_TYPES 0
+#define P2M_PAGED_TYPES 0
+#endif
 
 /* Shared types */
 /* XXX: Sharable types could include p2m_ram_ro too, but we would need to
diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h
index cc633fdc07..3982167144 100644
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -530,7 +530,7 @@ struct domain
     struct domain *parent; /* VM fork parent */
 #endif
     /* Memory paging support */
-#ifdef CONFIG_HAS_MEM_PAGING
+#ifdef CONFIG_MEM_PAGING
     struct vm_event_domain *vm_event_paging;
 #endif
     /* VM event monitor support */
diff --git a/xen/include/xsm/dummy.h b/xen/include/xsm/dummy.h
index a6dab0c809..363c6d7798 100644
--- a/xen/include/xsm/dummy.h
+++ b/xen/include/xsm/dummy.h
@@ -592,7 +592,7 @@ static XSM_INLINE int xsm_mem_access(XSM_DEFAULT_ARG struct domain *d)
 }
 #endif
 
-#ifdef CONFIG_HAS_MEM_PAGING
+#ifdef CONFIG_MEM_PAGING
 static XSM_INLINE int xsm_mem_paging(XSM_DEFAULT_ARG struct domain *d)
 {
     XSM_ASSERT_ACTION(XSM_DM_PRIV);
diff --git a/xen/include/xsm/xsm.h b/xen/include/xsm/xsm.h
index 7bdd254420..ad3cddbf7d 100644
--- a/xen/include/xsm/xsm.h
+++ b/xen/include/xsm/xsm.h
@@ -146,7 +146,7 @@ struct xsm_operations {
     int (*mem_access) (struct domain *d);
 #endif
 
-#ifdef CONFIG_HAS_MEM_PAGING
+#ifdef CONFIG_MEM_PAGING
     int (*mem_paging) (struct domain *d);
 #endif
 
@@ -592,7 +592,7 @@ static inline int xsm_mem_access (xsm_default_t def, struct domain *d)
 }
 #endif
 
-#ifdef CONFIG_HAS_MEM_PAGING
+#ifdef CONFIG_MEM_PAGING
 static inline int xsm_mem_paging (xsm_default_t def, struct domain *d)
 {
     return xsm_ops->mem_paging(d);
diff --git a/xen/xsm/dummy.c b/xen/xsm/dummy.c
index 627f12dbff..de44b10130 100644
--- a/xen/xsm/dummy.c
+++ b/xen/xsm/dummy.c
@@ -124,7 +124,7 @@ void __init xsm_fixup_ops (struct xsm_operations *ops)
     set_to_dummy_if_null(ops, mem_access);
 #endif
 
-#ifdef CONFIG_HAS_MEM_PAGING
+#ifdef CONFIG_MEM_PAGING
     set_to_dummy_if_null(ops, mem_paging);
 #endif
 
diff --git a/xen/xsm/flask/hooks.c b/xen/xsm/flask/hooks.c
index 5a24d01f04..f1a1217c98 100644
--- a/xen/xsm/flask/hooks.c
+++ b/xen/xsm/flask/hooks.c
@@ -1256,7 +1256,7 @@ static int flask_mem_access(struct domain *d)
 }
 #endif
 
-#ifdef CONFIG_HAS_MEM_PAGING
+#ifdef CONFIG_MEM_PAGING
 static int flask_mem_paging(struct domain *d)
 {
     return current_has_perm(d, SECCLASS_DOMAIN2, DOMAIN2__MEM_PAGING);
@@ -1829,7 +1829,7 @@ static struct xsm_operations flask_ops = {
     .mem_access = flask_mem_access,
 #endif
 
-#ifdef CONFIG_HAS_MEM_PAGING
+#ifdef CONFIG_MEM_PAGING
     .mem_paging = flask_mem_paging,
 #endif
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon May 03 13:34:26 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 03 May 2021 13:34:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.121599.229329 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ldYiQ-0006GG-EN; Mon, 03 May 2021 13:34:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 121599.229329; Mon, 03 May 2021 13:34:26 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ldYiQ-0006G8-BJ; Mon, 03 May 2021 13:34:26 +0000
Received: by outflank-mailman (input) for mailman id 121599;
 Mon, 03 May 2021 13:34:25 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldYiP-0006G2-QN
 for xen-changelog@lists.xenproject.org; Mon, 03 May 2021 13:34:25 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldYiP-0004rd-PV
 for xen-changelog@lists.xenproject.org; Mon, 03 May 2021 13:34:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldYiP-0004FV-On
 for xen-changelog@lists.xenproject.org; Mon, 03 May 2021 13:34:25 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=cpZ7iSWuRI5x6kuObIVgrFQz+TRykmWjLETpTSA42EI=; b=J6o1NAH3kboyxNa7Yev67BuEkw
	NS29WYX4N80HKtdGGCBfvA7o5FD3FUFTZNKPYrQZzibsf5x5YE96WgO4LureI2K5O1lxRnH0ArtZZ
	gnVAOBchFS6bXQtSKgKw2h99kcsP4HUQl5IrSTAph2Se/WUgbr6B62L08BUAi6dCRNtE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/p2m: {get,set}_entry hooks and p2m-pt.c are HVM-only
Message-Id: <E1ldYiP-0004FV-On@xenbits.xenproject.org>
Date: Mon, 03 May 2021 13:34:25 +0000

commit 8d012d3ddffcf9433befb756e14200c9a810f137
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon May 3 15:29:24 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon May 3 15:29:24 2021 +0200

    x86/p2m: {get,set}_entry hooks and p2m-pt.c are HVM-only
    
    With the hooks no longer needing setting, p2m_pt_init() degenerates to
    (about) nothing when !HVM. As a result, p2m-pt.c doesn't need building
    anymore in this case, as long as p2m_pt_init() has proper surrogates put
    in place.
    
    Unfortunately this means some new #ifdef-ary in p2m.c, but the mid-term
    plan there is to get rid of (almost) all of it by splitting out the then
    hopefully very few remaining non-HVM pieces.
    
    While the movement of the paging_mode_translate() check from
    p2m_remove_page() to guest_physmap_remove_page() may not be strictly
    necessary anymore (it was in an early version of this change), it looks
    more logical to live in the latter function, allowing to avoid acquiring
    the lock in the PV case. All other callers of p2m_remove_page() already
    have such a check anyway (in the altp2m case up the call stack).
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/mm/Makefile     |  4 ++--
 xen/arch/x86/mm/p2m-pt.c     |  8 --------
 xen/arch/x86/mm/p2m.c        | 28 +++++++++++++++++++++++-----
 xen/include/asm-x86/p2m.h    |  8 +++++++-
 xen/include/xen/p2m-common.h |  9 +++++++++
 5 files changed, 41 insertions(+), 16 deletions(-)

diff --git a/xen/arch/x86/mm/Makefile b/xen/arch/x86/mm/Makefile
index 5cc70005c9..b31041644f 100644
--- a/xen/arch/x86/mm/Makefile
+++ b/xen/arch/x86/mm/Makefile
@@ -7,8 +7,8 @@ obj-$(CONFIG_SHADOW_PAGING) += guest_walk_4.o
 obj-$(CONFIG_MEM_ACCESS) += mem_access.o
 obj-$(CONFIG_MEM_PAGING) += mem_paging.o
 obj-$(CONFIG_MEM_SHARING) += mem_sharing.o
-obj-y += p2m.o p2m-pt.o
-obj-$(CONFIG_HVM) += p2m-ept.o p2m-pod.o
+obj-y += p2m.o
+obj-$(CONFIG_HVM) += p2m-ept.o p2m-pod.o p2m-pt.o
 obj-y += paging.o
 
 guest_walk_%.o: guest_walk.c Makefile
diff --git a/xen/arch/x86/mm/p2m-pt.c b/xen/arch/x86/mm/p2m-pt.c
index efbe5fd195..f2afcf49a3 100644
--- a/xen/arch/x86/mm/p2m-pt.c
+++ b/xen/arch/x86/mm/p2m-pt.c
@@ -324,7 +324,6 @@ p2m_next_level(struct p2m_domain *p2m, void **table,
     return rc;
 }
 
-#ifdef CONFIG_HVM
 /*
  * Mark (via clearing the U flag) as needing P2M type re-calculation all valid
  * present entries at the targeted level for the passed in GFN range, which is
@@ -393,7 +392,6 @@ static int p2m_pt_set_recalc_range(struct p2m_domain *p2m,
 
     return err;
 }
-#endif /* CONFIG_HVM */
 
 /*
  * Handle possibly necessary P2M type re-calculation (U flag clear for a
@@ -932,8 +930,6 @@ pod_retry_l1:
     return (p2m_is_valid(*t) || p2m_is_any_ram(*t)) ? mfn : INVALID_MFN;
 }
 
-#ifdef CONFIG_HVM
-
 static void p2m_pt_change_entry_type_global(struct p2m_domain *p2m,
                                             p2m_type_t ot, p2m_type_t nt)
 {
@@ -1015,8 +1011,6 @@ static int p2m_pt_change_entry_type_range(struct p2m_domain *p2m,
     return err;
 }
 
-#endif /* CONFIG_HVM */
-
 #if P2M_AUDIT
 static long p2m_pt_audit_p2m(struct p2m_domain *p2m)
 {
@@ -1173,11 +1167,9 @@ void p2m_pt_init(struct p2m_domain *p2m)
 {
     p2m->set_entry = p2m_pt_set_entry;
     p2m->get_entry = p2m_pt_get_entry;
-#ifdef CONFIG_HVM
     p2m->recalc = do_recalc;
     p2m->change_entry_type_global = p2m_pt_change_entry_type_global;
     p2m->change_entry_type_range = p2m_pt_change_entry_type_range;
-#endif
 
     /* Still too early to use paging_mode_hap(). */
     if ( hap_enabled(p2m->domain) )
diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
index ad388e0802..64a90e5a97 100644
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -494,8 +494,10 @@ mfn_t __get_gfn_type_access(struct p2m_domain *p2m, unsigned long gfn_l,
                     p2m_type_t *t, p2m_access_t *a, p2m_query_t q,
                     unsigned int *page_order, bool_t locked)
 {
+#ifdef CONFIG_HVM
     mfn_t mfn;
     gfn_t gfn = _gfn(gfn_l);
+#endif
 
     /* Unshare makes no sense withuot populate. */
     if ( q & P2M_UNSHARE )
@@ -509,6 +511,7 @@ mfn_t __get_gfn_type_access(struct p2m_domain *p2m, unsigned long gfn_l,
         return _mfn(gfn_l);
     }
 
+#ifdef CONFIG_HVM
     if ( locked )
         /* Grab the lock here, don't release until put_gfn */
         gfn_lock(p2m, gfn, 0);
@@ -542,6 +545,7 @@ mfn_t __get_gfn_type_access(struct p2m_domain *p2m, unsigned long gfn_l,
     }
 
     return mfn;
+#endif
 }
 
 void __put_gfn(struct p2m_domain *p2m, unsigned long gfn)
@@ -620,6 +624,7 @@ struct page_info *p2m_get_page_from_gfn(
     return page;
 }
 
+#ifdef CONFIG_HVM
 /* Returns: 0 for success, -errno for failure */
 int p2m_set_entry(struct p2m_domain *p2m, gfn_t gfn, mfn_t mfn,
                   unsigned int page_order, p2m_type_t p2mt, p2m_access_t p2ma)
@@ -659,6 +664,7 @@ int p2m_set_entry(struct p2m_domain *p2m, gfn_t gfn, mfn_t mfn,
 
     return rc;
 }
+#endif
 
 mfn_t p2m_alloc_ptp(struct p2m_domain *p2m, unsigned int level)
 {
@@ -777,6 +783,8 @@ void p2m_final_teardown(struct domain *d)
     p2m_teardown_hostp2m(d);
 }
 
+#ifdef CONFIG_HVM
+
 static int __must_check
 p2m_remove_page(struct p2m_domain *p2m, gfn_t gfn, mfn_t mfn,
                 unsigned int page_order)
@@ -785,10 +793,6 @@ p2m_remove_page(struct p2m_domain *p2m, gfn_t gfn, mfn_t mfn,
     p2m_type_t t;
     p2m_access_t a;
 
-    /* IOMMU for PV guests is handled in get_page_type() and put_page(). */
-    if ( !paging_mode_translate(p2m->domain) )
-        return 0;
-
     ASSERT(gfn_locked_by_me(p2m, gfn));
     P2M_DEBUG("removing gfn=%#lx mfn=%#lx\n", gfn_x(gfn), mfn_x(mfn));
 
@@ -829,6 +833,10 @@ guest_physmap_remove_page(struct domain *d, gfn_t gfn,
     struct p2m_domain *p2m = p2m_get_hostp2m(d);
     int rc;
 
+    /* IOMMU for PV guests is handled in get_page_type() and put_page(). */
+    if ( !paging_mode_translate(d) )
+        return 0;
+
     gfn_lock(p2m, gfn, page_order);
     rc = p2m_remove_page(p2m, gfn, mfn, page_order);
     gfn_unlock(p2m, gfn, page_order);
@@ -836,6 +844,8 @@ guest_physmap_remove_page(struct domain *d, gfn_t gfn,
     return rc;
 }
 
+#endif /* CONFIG_HVM */
+
 int
 guest_physmap_add_page(struct domain *d, gfn_t gfn, mfn_t mfn,
                        unsigned int page_order)
@@ -1400,14 +1410,16 @@ int clear_mmio_p2m_entry(struct domain *d, unsigned long gfn_l, mfn_t mfn,
 int set_identity_p2m_entry(struct domain *d, unsigned long gfn_l,
                            p2m_access_t p2ma, unsigned int flag)
 {
+#ifdef CONFIG_HVM
     p2m_type_t p2mt;
     p2m_access_t a;
     gfn_t gfn = _gfn(gfn_l);
     mfn_t mfn;
     struct p2m_domain *p2m = p2m_get_hostp2m(d);
     int ret;
+#endif
 
-    if ( !paging_mode_translate(p2m->domain) )
+    if ( !paging_mode_translate(d) )
     {
         if ( !is_iommu_enabled(d) )
             return 0;
@@ -1416,6 +1428,7 @@ int set_identity_p2m_entry(struct domain *d, unsigned long gfn_l,
                                 IOMMUF_readable | IOMMUF_writable);
     }
 
+#ifdef CONFIG_HVM
     gfn_lock(p2m, gfn, 0);
 
     mfn = p2m->get_entry(p2m, gfn, &p2mt, &a, 0, NULL, NULL);
@@ -1439,16 +1452,19 @@ int set_identity_p2m_entry(struct domain *d, unsigned long gfn_l,
 
     gfn_unlock(p2m, gfn, 0);
     return ret;
+#endif
 }
 
 int clear_identity_p2m_entry(struct domain *d, unsigned long gfn_l)
 {
+#ifdef CONFIG_HVM
     p2m_type_t p2mt;
     p2m_access_t a;
     gfn_t gfn = _gfn(gfn_l);
     mfn_t mfn;
     struct p2m_domain *p2m = p2m_get_hostp2m(d);
     int ret;
+#endif
 
     if ( !paging_mode_translate(d) )
     {
@@ -1457,6 +1473,7 @@ int clear_identity_p2m_entry(struct domain *d, unsigned long gfn_l)
         return iommu_legacy_unmap(d, _dfn(gfn_l), 1ul << PAGE_ORDER_4K);
     }
 
+#ifdef CONFIG_HVM
     gfn_lock(p2m, gfn, 0);
 
     mfn = p2m->get_entry(p2m, gfn, &p2mt, &a, 0, NULL, NULL);
@@ -1476,6 +1493,7 @@ int clear_identity_p2m_entry(struct domain *d, unsigned long gfn_l)
     }
 
     return ret;
+#endif
 }
 
 #ifdef CONFIG_MEM_SHARING
diff --git a/xen/include/asm-x86/p2m.h b/xen/include/asm-x86/p2m.h
index b7da310f70..776d3bb1b5 100644
--- a/xen/include/asm-x86/p2m.h
+++ b/xen/include/asm-x86/p2m.h
@@ -251,6 +251,7 @@ struct p2m_domain {
     /* Pages used to construct the p2m */
     struct page_list_head pages;
 
+#ifdef CONFIG_HVM
     int                (*set_entry)(struct p2m_domain *p2m,
                                     gfn_t gfn,
                                     mfn_t mfn, unsigned int page_order,
@@ -264,7 +265,6 @@ struct p2m_domain {
                                     p2m_query_t q,
                                     unsigned int *page_order,
                                     bool_t *sve);
-#ifdef CONFIG_HVM
     int                (*recalc)(struct p2m_domain *p2m,
                                  unsigned long gfn);
     void               (*enable_hardware_log_dirty)(struct p2m_domain *p2m);
@@ -793,8 +793,14 @@ int __must_check p2m_set_entry(struct p2m_domain *p2m, gfn_t gfn, mfn_t mfn,
                                unsigned int page_order, p2m_type_t p2mt,
                                p2m_access_t p2ma);
 
+#if defined(CONFIG_HVM)
 /* Set up function pointers for PT implementation: only for use by p2m code */
 extern void p2m_pt_init(struct p2m_domain *p2m);
+#elif defined(CONFIG_SHADOW_PAGING)
+# define p2m_pt_init shadow_p2m_init
+#else
+static inline void p2m_pt_init(struct p2m_domain *p2m) {}
+#endif
 
 void *map_domain_gfn(struct p2m_domain *p2m, gfn_t gfn, mfn_t *mfn,
                      p2m_query_t q, uint32_t *pfec);
diff --git a/xen/include/xen/p2m-common.h b/xen/include/xen/p2m-common.h
index a322e738ef..80bac95057 100644
--- a/xen/include/xen/p2m-common.h
+++ b/xen/include/xen/p2m-common.h
@@ -8,9 +8,18 @@ int set_foreign_p2m_entry(struct domain *d, const struct domain *fd,
                           unsigned long gfn, mfn_t mfn);
 
 /* Remove a page from a domain's p2m table */
+#ifdef CONFIG_HVM
 int __must_check
 guest_physmap_remove_page(struct domain *d, gfn_t gfn, mfn_t mfn,
                           unsigned int page_order);
+#else
+static inline int
+guest_physmap_remove_page(struct domain *d, gfn_t gfn, mfn_t mfn,
+                          unsigned int page_order)
+{
+    return 0;
+}
+#endif
 
 /* Map MMIO regions in the p2m: start_gfn and nr describe the range in
  *  * the guest physical address space to map, starting from the machine
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon May 03 13:34:36 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 03 May 2021 13:34:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.121600.229333 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ldYia-0006Hm-HC; Mon, 03 May 2021 13:34:36 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 121600.229333; Mon, 03 May 2021 13:34:36 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ldYia-0006He-ED; Mon, 03 May 2021 13:34:36 +0000
Received: by outflank-mailman (input) for mailman id 121600;
 Mon, 03 May 2021 13:34:35 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldYiZ-0006HY-Te
 for xen-changelog@lists.xenproject.org; Mon, 03 May 2021 13:34:35 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldYiZ-0004rp-Sn
 for xen-changelog@lists.xenproject.org; Mon, 03 May 2021 13:34:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldYiZ-0004GS-S2
 for xen-changelog@lists.xenproject.org; Mon, 03 May 2021 13:34:35 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=P+BVfkEtCfPvzVTTjlHbHsADaxw2mMxCQquxYHZoUCU=; b=M+sfHjnP9Cl6Z2xS/8/1ZATYqP
	beSkc9wB6YVxyl7YHstZrkWmbpT1fMM5MsGRJpKw1CmKRV8bnY9ZHXr3u6ABgpVdhEEf5pQnYbI0m
	zbySg6vzUXaeB6j4sAT7o65HM5OsfuHa0wu2cjv0DPzgg3SMp+YMdHmSBPdJErVvqIXQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/p2m: write_p2m_entry_{pre,post} hooks are HVM-only
Message-Id: <E1ldYiZ-0004GS-S2@xenbits.xenproject.org>
Date: Mon, 03 May 2021 13:34:35 +0000

commit 9b9ef2388c238a5b0d070a76a50efe696052bc52
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon May 3 15:29:49 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon May 3 15:29:49 2021 +0200

    x86/p2m: write_p2m_entry_{pre,post} hooks are HVM-only
    
    Move respective shadow code to its HVM-only source file, thus making it
    possible to exclude the hooks as well. This then shows that
    shadow_p2m_init() also isn't needed in !HVM builds.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Tim Deegan <tim@xen.org>
---
 xen/arch/x86/mm/shadow/common.c | 136 ----------------------------------------
 xen/arch/x86/mm/shadow/hvm.c    | 136 ++++++++++++++++++++++++++++++++++++++++
 xen/include/asm-x86/p2m.h       |   4 +-
 3 files changed, 137 insertions(+), 139 deletions(-)

diff --git a/xen/arch/x86/mm/shadow/common.c b/xen/arch/x86/mm/shadow/common.c
index 72d3816fcc..b060ebcb72 100644
--- a/xen/arch/x86/mm/shadow/common.c
+++ b/xen/arch/x86/mm/shadow/common.c
@@ -2289,22 +2289,6 @@ void shadow_prepare_page_type_change(struct domain *d, struct page_info *page,
     shadow_remove_all_shadows(d, page_to_mfn(page));
 }
 
-static void
-sh_remove_all_shadows_and_parents(struct domain *d, mfn_t gmfn)
-/* Even harsher: this is a HVM page that we thing is no longer a pagetable.
- * Unshadow it, and recursively unshadow pages that reference it. */
-{
-    sh_remove_shadows(d, gmfn, 0, 1);
-    /* XXX TODO:
-     * Rework this hashtable walker to return a linked-list of all
-     * the shadows it modified, then do breadth-first recursion
-     * to find the way up to higher-level tables and unshadow them too.
-     *
-     * The current code (just tearing down each page's shadows as we
-     * detect that it is not a pagetable) is correct, but very slow.
-     * It means extra emulated writes and slows down removal of mappings. */
-}
-
 /**************************************************************************/
 
 /* Reset the up-pointers of every L3 shadow to 0.
@@ -3031,126 +3015,6 @@ static int shadow_test_disable(struct domain *d)
     return ret;
 }
 
-/**************************************************************************/
-/* P2M map manipulations */
-
-/* shadow specific code which should be called when P2M table entry is updated
- * with new content. It is responsible for update the entry, as well as other
- * shadow processing jobs.
- */
-
-static void sh_unshadow_for_p2m_change(struct domain *d, unsigned long gfn,
-                                       l1_pgentry_t old, l1_pgentry_t new,
-                                       unsigned int level)
-{
-    mfn_t omfn = l1e_get_mfn(old);
-    unsigned int oflags = l1e_get_flags(old);
-    p2m_type_t p2mt = p2m_flags_to_type(oflags);
-    bool flush = false;
-
-    /*
-     * If there are any shadows, update them.  But if shadow_teardown()
-     * has already been called then it's not safe to try.
-     */
-    if ( unlikely(!d->arch.paging.shadow.total_pages) )
-        return;
-
-    switch ( level )
-    {
-    default:
-        /*
-         * The following assertion is to make sure we don't step on 1GB host
-         * page support of HVM guest.
-         */
-        ASSERT(!((oflags & _PAGE_PRESENT) && (oflags & _PAGE_PSE)));
-        break;
-
-    /* If we're removing an MFN from the p2m, remove it from the shadows too */
-    case 1:
-        if ( (p2m_is_valid(p2mt) || p2m_is_grant(p2mt)) && mfn_valid(omfn) )
-        {
-            sh_remove_all_shadows_and_parents(d, omfn);
-            if ( sh_remove_all_mappings(d, omfn, _gfn(gfn)) )
-                flush = true;
-        }
-        break;
-
-    /*
-     * If we're removing a superpage mapping from the p2m, we need to check
-     * all the pages covered by it.  If they're still there in the new
-     * scheme, that's OK, but otherwise they must be unshadowed.
-     */
-    case 2:
-        if ( !(oflags & _PAGE_PRESENT) || !(oflags & _PAGE_PSE) )
-            break;
-
-        if ( p2m_is_valid(p2mt) && mfn_valid(omfn) )
-        {
-            unsigned int i;
-            mfn_t nmfn = l1e_get_mfn(new);
-            l1_pgentry_t *npte = NULL;
-
-            /* If we're replacing a superpage with a normal L1 page, map it */
-            if ( (l1e_get_flags(new) & _PAGE_PRESENT) &&
-                 !(l1e_get_flags(new) & _PAGE_PSE) &&
-                 mfn_valid(nmfn) )
-                npte = map_domain_page(nmfn);
-
-            gfn &= ~(L1_PAGETABLE_ENTRIES - 1);
-
-            for ( i = 0; i < L1_PAGETABLE_ENTRIES; i++ )
-            {
-                if ( !npte ||
-                     !p2m_is_ram(p2m_flags_to_type(l1e_get_flags(npte[i]))) ||
-                     !mfn_eq(l1e_get_mfn(npte[i]), omfn) )
-                {
-                    /* This GFN->MFN mapping has gone away */
-                    sh_remove_all_shadows_and_parents(d, omfn);
-                    if ( sh_remove_all_mappings(d, omfn, _gfn(gfn + i)) )
-                        flush = true;
-                }
-                omfn = mfn_add(omfn, 1);
-            }
-
-            if ( npte )
-                unmap_domain_page(npte);
-        }
-
-        break;
-    }
-
-    if ( flush )
-        guest_flush_tlb_mask(d, d->dirty_cpumask);
-}
-
-#if (SHADOW_OPTIMIZATIONS & SHOPT_FAST_FAULT_PATH)
-static void
-sh_write_p2m_entry_post(struct p2m_domain *p2m, unsigned int oflags)
-{
-    struct domain *d = p2m->domain;
-
-    /* If we're doing FAST_FAULT_PATH, then shadow mode may have
-       cached the fact that this is an mmio region in the shadow
-       page tables.  Blow the tables away to remove the cache.
-       This is pretty heavy handed, but this is a rare operation
-       (it might happen a dozen times during boot and then never
-       again), so it doesn't matter too much. */
-    if ( d->arch.paging.shadow.has_fast_mmio_entries )
-    {
-        shadow_blow_tables(d);
-        d->arch.paging.shadow.has_fast_mmio_entries = false;
-    }
-}
-#else
-# define sh_write_p2m_entry_post NULL
-#endif
-
-void shadow_p2m_init(struct p2m_domain *p2m)
-{
-    p2m->write_p2m_entry_pre  = sh_unshadow_for_p2m_change;
-    p2m->write_p2m_entry_post = sh_write_p2m_entry_post;
-}
-
 /**************************************************************************/
 /* Log-dirty mode support */
 
diff --git a/xen/arch/x86/mm/shadow/hvm.c b/xen/arch/x86/mm/shadow/hvm.c
index 7f98286385..d5f42102a0 100644
--- a/xen/arch/x86/mm/shadow/hvm.c
+++ b/xen/arch/x86/mm/shadow/hvm.c
@@ -773,6 +773,142 @@ void sh_destroy_monitor_table(const struct vcpu *v, mfn_t mmfn,
     shadow_free(d, mmfn);
 }
 
+/**************************************************************************/
+/* P2M map manipulations */
+
+/* shadow specific code which should be called when P2M table entry is updated
+ * with new content. It is responsible for update the entry, as well as other
+ * shadow processing jobs.
+ */
+
+static void
+sh_remove_all_shadows_and_parents(struct domain *d, mfn_t gmfn)
+/* Even harsher: this is a HVM page that we thing is no longer a pagetable.
+ * Unshadow it, and recursively unshadow pages that reference it. */
+{
+    sh_remove_shadows(d, gmfn, 0, 1);
+    /* XXX TODO:
+     * Rework this hashtable walker to return a linked-list of all
+     * the shadows it modified, then do breadth-first recursion
+     * to find the way up to higher-level tables and unshadow them too.
+     *
+     * The current code (just tearing down each page's shadows as we
+     * detect that it is not a pagetable) is correct, but very slow.
+     * It means extra emulated writes and slows down removal of mappings. */
+}
+
+static void sh_unshadow_for_p2m_change(struct domain *d, unsigned long gfn,
+                                       l1_pgentry_t old, l1_pgentry_t new,
+                                       unsigned int level)
+{
+    mfn_t omfn = l1e_get_mfn(old);
+    unsigned int oflags = l1e_get_flags(old);
+    p2m_type_t p2mt = p2m_flags_to_type(oflags);
+    bool flush = false;
+
+    /*
+     * If there are any shadows, update them.  But if shadow_teardown()
+     * has already been called then it's not safe to try.
+     */
+    if ( unlikely(!d->arch.paging.shadow.total_pages) )
+        return;
+
+    switch ( level )
+    {
+    default:
+        /*
+         * The following assertion is to make sure we don't step on 1GB host
+         * page support of HVM guest.
+         */
+        ASSERT(!((oflags & _PAGE_PRESENT) && (oflags & _PAGE_PSE)));
+        break;
+
+    /* If we're removing an MFN from the p2m, remove it from the shadows too */
+    case 1:
+        if ( (p2m_is_valid(p2mt) || p2m_is_grant(p2mt)) && mfn_valid(omfn) )
+        {
+            sh_remove_all_shadows_and_parents(d, omfn);
+            if ( sh_remove_all_mappings(d, omfn, _gfn(gfn)) )
+                flush = true;
+        }
+        break;
+
+    /*
+     * If we're removing a superpage mapping from the p2m, we need to check
+     * all the pages covered by it.  If they're still there in the new
+     * scheme, that's OK, but otherwise they must be unshadowed.
+     */
+    case 2:
+        if ( !(oflags & _PAGE_PRESENT) || !(oflags & _PAGE_PSE) )
+            break;
+
+        if ( p2m_is_valid(p2mt) && mfn_valid(omfn) )
+        {
+            unsigned int i;
+            mfn_t nmfn = l1e_get_mfn(new);
+            l1_pgentry_t *npte = NULL;
+
+            /* If we're replacing a superpage with a normal L1 page, map it */
+            if ( (l1e_get_flags(new) & _PAGE_PRESENT) &&
+                 !(l1e_get_flags(new) & _PAGE_PSE) &&
+                 mfn_valid(nmfn) )
+                npte = map_domain_page(nmfn);
+
+            gfn &= ~(L1_PAGETABLE_ENTRIES - 1);
+
+            for ( i = 0; i < L1_PAGETABLE_ENTRIES; i++ )
+            {
+                if ( !npte ||
+                     !p2m_is_ram(p2m_flags_to_type(l1e_get_flags(npte[i]))) ||
+                     !mfn_eq(l1e_get_mfn(npte[i]), omfn) )
+                {
+                    /* This GFN->MFN mapping has gone away */
+                    sh_remove_all_shadows_and_parents(d, omfn);
+                    if ( sh_remove_all_mappings(d, omfn, _gfn(gfn + i)) )
+                        flush = true;
+                }
+                omfn = mfn_add(omfn, 1);
+            }
+
+            if ( npte )
+                unmap_domain_page(npte);
+        }
+
+        break;
+    }
+
+    if ( flush )
+        guest_flush_tlb_mask(d, d->dirty_cpumask);
+}
+
+#if (SHADOW_OPTIMIZATIONS & SHOPT_FAST_FAULT_PATH)
+static void
+sh_write_p2m_entry_post(struct p2m_domain *p2m, unsigned int oflags)
+{
+    struct domain *d = p2m->domain;
+
+    /* If we're doing FAST_FAULT_PATH, then shadow mode may have
+       cached the fact that this is an mmio region in the shadow
+       page tables.  Blow the tables away to remove the cache.
+       This is pretty heavy handed, but this is a rare operation
+       (it might happen a dozen times during boot and then never
+       again), so it doesn't matter too much. */
+    if ( d->arch.paging.shadow.has_fast_mmio_entries )
+    {
+        shadow_blow_tables(d);
+        d->arch.paging.shadow.has_fast_mmio_entries = false;
+    }
+}
+#else
+# define sh_write_p2m_entry_post NULL
+#endif
+
+void shadow_p2m_init(struct p2m_domain *p2m)
+{
+    p2m->write_p2m_entry_pre  = sh_unshadow_for_p2m_change;
+    p2m->write_p2m_entry_post = sh_write_p2m_entry_post;
+}
+
 /**************************************************************************/
 /* VRAM dirty tracking support */
 int shadow_track_dirty_vram(struct domain *d,
diff --git a/xen/include/asm-x86/p2m.h b/xen/include/asm-x86/p2m.h
index 776d3bb1b5..f33ae2327d 100644
--- a/xen/include/asm-x86/p2m.h
+++ b/xen/include/asm-x86/p2m.h
@@ -278,7 +278,6 @@ struct p2m_domain {
                                                   unsigned long first_gfn,
                                                   unsigned long last_gfn);
     void               (*memory_type_changed)(struct p2m_domain *p2m);
-#endif
     void               (*write_p2m_entry_pre)(struct domain *d,
                                               unsigned long gfn,
                                               l1_pgentry_t old,
@@ -286,6 +285,7 @@ struct p2m_domain {
                                               unsigned int level);
     void               (*write_p2m_entry_post)(struct p2m_domain *p2m,
                                                unsigned int oflags);
+#endif
 #if P2M_AUDIT
     long               (*audit_p2m)(struct p2m_domain *p2m);
 #endif
@@ -796,8 +796,6 @@ int __must_check p2m_set_entry(struct p2m_domain *p2m, gfn_t gfn, mfn_t mfn,
 #if defined(CONFIG_HVM)
 /* Set up function pointers for PT implementation: only for use by p2m code */
 extern void p2m_pt_init(struct p2m_domain *p2m);
-#elif defined(CONFIG_SHADOW_PAGING)
-# define p2m_pt_init shadow_p2m_init
 #else
 static inline void p2m_pt_init(struct p2m_domain *p2m) {}
 #endif
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon May 03 13:34:46 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 03 May 2021 13:34:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.121601.229337 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ldYik-0006Jc-Ij; Mon, 03 May 2021 13:34:46 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 121601.229337; Mon, 03 May 2021 13:34:46 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ldYik-0006JU-Fn; Mon, 03 May 2021 13:34:46 +0000
Received: by outflank-mailman (input) for mailman id 121601;
 Mon, 03 May 2021 13:34:46 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldYik-0006JP-0e
 for xen-changelog@lists.xenproject.org; Mon, 03 May 2021 13:34:46 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldYij-0004s3-W5
 for xen-changelog@lists.xenproject.org; Mon, 03 May 2021 13:34:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldYij-0004H9-VJ
 for xen-changelog@lists.xenproject.org; Mon, 03 May 2021 13:34:45 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=rp5vNpk5izVCahWIZYDxPcap68s1R4mxWLm9xt7c/fE=; b=T1q9t8gRNmxBmEdA63bsHiONvj
	OCvm0hfRm6PjXPjzu14zL2rIYX/nTDR6WSrWBt4zonKA1bMq/w2kT6dOT+s8ww30g4SlL/ajEd6ax
	dVjsrTWqStgDx++MVmnYtZQ83SNLp9wqdc6PPNQ2p1hzki3/Dcu+ExGEMcJXvi/6ryz4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/p2m: re-arrange struct p2m_domain
Message-Id: <E1ldYij-0004H9-VJ@xenbits.xenproject.org>
Date: Mon, 03 May 2021 13:34:45 +0000

commit 7191b808b0c2cb635f77bd4be34608cb0299a33d
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon May 3 15:30:16 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon May 3 15:30:16 2021 +0200

    x86/p2m: re-arrange struct p2m_domain
    
    Combine two HVM-specific sections in two cases (i.e. going from four of
    them to just two). Make defer_nested_flush bool and HVM-only, moving it
    next to other nested stuff. Move default_access up into a padding hole.
    
    When moving them anyway, also adjust comment style.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/mm/p2m.c     |  4 +--
 xen/include/asm-x86/p2m.h | 62 +++++++++++++++++++++++++----------------------
 2 files changed, 35 insertions(+), 31 deletions(-)

diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
index 64a90e5a97..8f4816c414 100644
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -1167,7 +1167,7 @@ void p2m_change_type_range(struct domain *d,
     ASSERT(p2m_is_changeable(ot) && p2m_is_changeable(nt));
 
     p2m_lock(hostp2m);
-    hostp2m->defer_nested_flush = 1;
+    hostp2m->defer_nested_flush = true;
 
     change_type_range(hostp2m, start, end, ot, nt);
 
@@ -1185,7 +1185,7 @@ void p2m_change_type_range(struct domain *d,
                 p2m_unlock(altp2m);
             }
     }
-    hostp2m->defer_nested_flush = 0;
+    hostp2m->defer_nested_flush = false;
     if ( nestedhvm_enabled(d) )
         p2m_flush_nestedp2m(d);
 
diff --git a/xen/include/asm-x86/p2m.h b/xen/include/asm-x86/p2m.h
index f33ae2327d..5b697df573 100644
--- a/xen/include/asm-x86/p2m.h
+++ b/xen/include/asm-x86/p2m.h
@@ -216,20 +216,15 @@ struct p2m_domain {
 
     p2m_class_t       p2m_class; /* host/nested/alternate */
 
-#ifdef CONFIG_HVM
-    /* Nested p2ms only: nested p2m base value that this p2m shadows.
-     * This can be cleared to P2M_BASE_EADDR under the per-p2m lock but
-     * needs both the per-p2m lock and the per-domain nestedp2m lock
-     * to set it to any other value. */
-#define P2M_BASE_EADDR     (~0ULL)
-    uint64_t           np2m_base;
-    uint64_t           np2m_generation;
+    /*
+     * Default P2M access type for each page in the the domain: new pages,
+     * swapped in pages, cleared pages, and pages that are ambiguously
+     * retyped get this access type.  See definition of p2m_access_t.
+     */
+    p2m_access_t default_access;
 
-    /* Nested p2ms: linked list of n2pms allocated to this domain. 
-     * The host p2m hasolds the head of the list and the np2ms are 
-     * threaded on in LRU order. */
-    struct list_head   np2m_list;
-#endif
+    /* Pages used to construct the p2m */
+    struct page_list_head pages;
 
     /* Host p2m: Log-dirty ranges registered for the domain. */
     struct rangeset   *logdirty_ranges;
@@ -237,21 +232,10 @@ struct p2m_domain {
     /* Host p2m: Global log-dirty mode enabled for the domain. */
     bool               global_logdirty;
 
-    /* Host p2m: when this flag is set, don't flush all the nested-p2m 
-     * tables on every host-p2m change.  The setter of this flag 
-     * is responsible for performing the full flush before releasing the
-     * host p2m's lock. */
-    int                defer_nested_flush;
-
 #ifdef CONFIG_HVM
     /* Alternate p2m: count of vcpu's currently using this p2m. */
     atomic_t           active_vcpus;
-#endif
-
-    /* Pages used to construct the p2m */
-    struct page_list_head pages;
 
-#ifdef CONFIG_HVM
     int                (*set_entry)(struct p2m_domain *p2m,
                                     gfn_t gfn,
                                     mfn_t mfn, unsigned int page_order,
@@ -306,11 +290,6 @@ struct p2m_domain {
     unsigned int defer_flush;
     bool_t need_flush;
 
-    /* Default P2M access type for each page in the the domain: new pages,
-     * swapped in pages, cleared pages, and pages that are ambiguously
-     * retyped get this access type.  See definition of p2m_access_t. */
-    p2m_access_t default_access;
-
     /* If true, and an access fault comes in and there is no vm_event listener, 
      * pause domain.  Otherwise, remove access restrictions. */
     bool_t       access_required;
@@ -357,6 +336,31 @@ struct p2m_domain {
         mm_lock_t        lock;         /* Locking of private pod structs,   *
                                         * not relying on the p2m lock.      */
     } pod;
+
+    /*
+     * Host p2m: when this flag is set, don't flush all the nested-p2m
+     * tables on every host-p2m change.  The setter of this flag
+     * is responsible for performing the full flush before releasing the
+     * host p2m's lock.
+     */
+    bool               defer_nested_flush;
+
+    /*
+     * Nested p2ms only: nested p2m base value that this p2m shadows.
+     * This can be cleared to P2M_BASE_EADDR under the per-p2m lock but
+     * needs both the per-p2m lock and the per-domain nestedp2m lock
+     * to set it to any other value.
+     */
+#define P2M_BASE_EADDR     (~0ULL)
+    uint64_t           np2m_base;
+    uint64_t           np2m_generation;
+
+    /*
+     * Nested p2ms: linked list of n2pms allocated to this domain.
+     * The host p2m hasolds the head of the list and the np2ms are
+     * threaded on in LRU order.
+     */
+    struct list_head   np2m_list;
 #endif
 
     union {
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon May 03 13:34:57 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 03 May 2021 13:34:57 +0000
Received: from list by lists.xenproject.org with outflank-mailman.121602.229341 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ldYiv-0006Km-KC; Mon, 03 May 2021 13:34:57 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 121602.229341; Mon, 03 May 2021 13:34:57 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ldYiv-0006Ke-HN; Mon, 03 May 2021 13:34:57 +0000
Received: by outflank-mailman (input) for mailman id 121602;
 Mon, 03 May 2021 13:34:56 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldYiu-0006KW-3X
 for xen-changelog@lists.xenproject.org; Mon, 03 May 2021 13:34:56 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldYiu-0004sI-2l
 for xen-changelog@lists.xenproject.org; Mon, 03 May 2021 13:34:56 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldYiu-0004Hr-22
 for xen-changelog@lists.xenproject.org; Mon, 03 May 2021 13:34:56 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=7CXF8EVvTU9bDD7YRsjulVXWqFBJ5lf2rT6L13Ns4kw=; b=b7xmytXzKzrSESo9xNdvWRCXje
	yLX+T5paX9Vndvco3dXaYF0o4Cd0o6ArERd4xpm5nACchbInZXEtAQst5gX6U4ByL+6Q710O2D0vC
	FY7HGEh+NjZz/qsDTbkEW+Nc1dT9XW3LXCitoECw9fAxAHa32f0ThNd1K/oa/AqZkuxg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] iommu: move iommu_update_ire_from_msi() to xen/iommu.h
Message-Id: <E1ldYiu-0004Hr-22@xenbits.xenproject.org>
Date: Mon, 03 May 2021 13:34:56 +0000

commit 705f7b55be551b9d39b5ab52689a330d73f9c8eb
Author:     Rahul Singh <rahul.singh@arm.com>
AuthorDate: Mon May 3 15:30:57 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon May 3 15:30:57 2021 +0200

    iommu: move iommu_update_ire_from_msi() to xen/iommu.h
    
    Move iommu_update_ire_from_msi(..) from passthrough/pci.c to
    xen/iommu.h and wrap it under CONFIG_X86 as it is referenced in x86
    code only to avoid compilation error for other architecture when
    HAS_PCI is enabled.
    
    No functional change intended.
    
    Signed-off-by: Rahul Singh <rahul.singh@arm.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/drivers/passthrough/pci.c |  7 -------
 xen/include/xen/iommu.h       | 13 ++++++++++---
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/xen/drivers/passthrough/pci.c b/xen/drivers/passthrough/pci.c
index 705137f8be..199ce08612 100644
--- a/xen/drivers/passthrough/pci.c
+++ b/xen/drivers/passthrough/pci.c
@@ -1303,13 +1303,6 @@ static int __init setup_dump_pcidevs(void)
 }
 __initcall(setup_dump_pcidevs);
 
-int iommu_update_ire_from_msi(
-    struct msi_desc *msi_desc, struct msi_msg *msg)
-{
-    return iommu_intremap
-           ? iommu_call(&iommu_ops, update_ire_from_msi, msi_desc, msg) : 0;
-}
-
 static int iommu_add_device(struct pci_dev *pdev)
 {
     const struct domain_iommu *hd;
diff --git a/xen/include/xen/iommu.h b/xen/include/xen/iommu.h
index 4f0e5ac622..460755df29 100644
--- a/xen/include/xen/iommu.h
+++ b/xen/include/xen/iommu.h
@@ -187,8 +187,6 @@ void free_hvm_irq_dpci(struct hvm_irq_dpci *dpci);
 struct msi_desc;
 struct msi_msg;
 
-int iommu_update_ire_from_msi(struct msi_desc *msi_desc, struct msi_msg *msg);
-
 #define PT_IRQ_TIME_OUT MILLISECS(8)
 #endif /* HAS_PCI */
 
@@ -238,7 +236,6 @@ struct iommu_ops {
                            u8 devfn, device_t *dev);
 #ifdef CONFIG_HAS_PCI
     int (*get_device_group_id)(u16 seg, u8 bus, u8 devfn);
-    int (*update_ire_from_msi)(struct msi_desc *msi_desc, struct msi_msg *msg);
 #endif /* HAS_PCI */
 
     void (*teardown)(struct domain *d);
@@ -267,6 +264,7 @@ struct iommu_ops {
     int (*adjust_irq_affinities)(void);
     void (*sync_cache)(const void *addr, unsigned int size);
     void (*clear_root_pgtable)(struct domain *d);
+    int (*update_ire_from_msi)(struct msi_desc *msi_desc, struct msi_msg *msg);
 #endif /* CONFIG_X86 */
 
     int __must_check (*suspend)(void);
@@ -374,6 +372,15 @@ extern struct page_list_head iommu_pt_cleanup_list;
 
 bool arch_iommu_use_permitted(const struct domain *d);
 
+#ifdef CONFIG_X86
+static inline int iommu_update_ire_from_msi(
+    struct msi_desc *msi_desc, struct msi_msg *msg)
+{
+    return iommu_intremap
+           ? iommu_call(&iommu_ops, update_ire_from_msi, msi_desc, msg) : 0;
+}
+#endif
+
 #endif /* _IOMMU_H_ */
 
 /*
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon May 03 13:35:07 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 03 May 2021 13:35:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.121603.229345 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ldYj5-0006Lw-Lr; Mon, 03 May 2021 13:35:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 121603.229345; Mon, 03 May 2021 13:35:07 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ldYj5-0006Lo-Iw; Mon, 03 May 2021 13:35:07 +0000
Received: by outflank-mailman (input) for mailman id 121603;
 Mon, 03 May 2021 13:35:06 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldYj4-0006Ld-7v
 for xen-changelog@lists.xenproject.org; Mon, 03 May 2021 13:35:06 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldYj4-0004sd-7A
 for xen-changelog@lists.xenproject.org; Mon, 03 May 2021 13:35:06 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldYj4-0004It-5h
 for xen-changelog@lists.xenproject.org; Mon, 03 May 2021 13:35:06 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=fAn35acooxib6cgxddyqbk99GlA+oQTJIk9zZ4gD/Tw=; b=0edXsFkEcZR5cGqII7G0LEk6dR
	LyRGpVck5K0FBZTrKZo7YRhTdCtri2muczM4/AZg+/meHavbheFhrbXB3jz+MvvXppTJIe1jK6y00
	T0ENVOl3RwU7BLqUukh4soFvXmAIzSU2IMih4WPCJNM53C8VRhS99S3N0ngkio7OmnkM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86emul: support RDPKRU/WRPKRU
Message-Id: <E1ldYj4-0004It-5h@xenbits.xenproject.org>
Date: Mon, 03 May 2021 13:35:06 +0000

commit d26c277826dbbd64b3e3cb57159e1ecbfad33bc8
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon May 3 15:31:43 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon May 3 15:31:43 2021 +0200

    x86emul: support RDPKRU/WRPKRU
    
    Since we support PKU for HVM guests, the respective insns should also be
    recognized by the emulator.
    
    In emul_test_read_cr() instead of further extending the comment to
    explain the hex numbers, switch to using X86_CR4_* values.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/tests/x86_emulator/test_x86_emulator.c | 17 ++++++++++++++
 tools/tests/x86_emulator/x86-emulate.c       | 16 ++++++++++++--
 xen/arch/x86/x86_emulate/x86_emulate.c       | 33 ++++++++++++++++++++++++++++
 xen/include/asm-x86/processor.h              |  6 +++++
 4 files changed, 70 insertions(+), 2 deletions(-)

diff --git a/tools/tests/x86_emulator/test_x86_emulator.c b/tools/tests/x86_emulator/test_x86_emulator.c
index cbb8f34f58..9677476db0 100644
--- a/tools/tests/x86_emulator/test_x86_emulator.c
+++ b/tools/tests/x86_emulator/test_x86_emulator.c
@@ -2399,6 +2399,23 @@ int main(int argc, char **argv)
         goto fail;
     printf("okay\n");
 
+    printf("%-40s", "Testing rdpkru / wrpkru...");
+    instr[0] = 0x0f; instr[1] = 0x01;
+    regs.ecx = 0;
+    for ( i = 0, j = (uint32_t)-__LINE__; i < 3; ++i )
+    {
+        instr[2] = 0xee | (i & 1);
+        regs.eax = i < 2 ? j : 0;
+        regs.edx = i & 1 ? 0 : j;
+        regs.eip = (unsigned long)&instr[0];
+        rc = x86_emulate(&ctxt, &emulops);
+        if ( (rc != X86EMUL_OKAY) ||
+             (!(i & 1) && (regs.eax != (i ? j : 0) || regs.edx)) ||
+             (regs.eip != (unsigned long)&instr[3]) )
+            goto fail;
+    }
+    printf("okay\n");
+
     printf("%-40s", "Testing movdiri %edx,(%ecx)...");
     if ( stack_exec && cpu_has_movdiri )
     {
diff --git a/tools/tests/x86_emulator/x86-emulate.c b/tools/tests/x86_emulator/x86-emulate.c
index fb34933e82..07f892dbbb 100644
--- a/tools/tests/x86_emulator/x86-emulate.c
+++ b/tools/tests/x86_emulator/x86-emulate.c
@@ -184,8 +184,8 @@ int emul_test_read_cr(
         return X86EMUL_OKAY;
 
     case 4:
-        /* OSFXSR, OSXMMEXCPT, and maybe OSXSAVE */
-        *val = 0x00000600 | (cpu_has_xsave ? 0x00040000 : 0);
+        *val = X86_CR4_OSFXSR | X86_CR4_OSXMMEXCPT | X86_CR4_PKE |
+               (cpu_has_xsave ? X86_CR4_OSXSAVE : 0);
         return X86EMUL_OKAY;
     }
 
@@ -256,4 +256,16 @@ void emul_test_put_fpu(
     /* TBD */
 }
 
+static uint32_t pkru;
+
+static unsigned int rdpkru(void)
+{
+    return pkru;
+}
+
+static void wrpkru(unsigned int val)
+{
+    pkru = val;
+}
+
 #include "x86_emulate/x86_emulate.c"
diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c
index 4a33fe9613..c25d88d0d8 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -5815,6 +5815,39 @@ x86_emulate(
             }
             break;
 
+        case 0xee:
+            switch ( vex.pfx )
+            {
+            case vex_none: /* rdpkru */
+                if ( !ops->read_cr ||
+                     ops->read_cr(4, &cr4, ctxt) != X86EMUL_OKAY )
+                    cr4 = 0;
+                generate_exception_if(!(cr4 & X86_CR4_PKE), EXC_UD);
+                generate_exception_if(_regs.ecx, EXC_GP, 0);
+                _regs.r(ax) = rdpkru();
+                _regs.r(dx) = 0;
+                break;
+            default:
+                goto unimplemented_insn;
+            }
+            break;
+
+        case 0xef:
+            switch ( vex.pfx )
+            {
+            case vex_none: /* wrpkru */
+                if ( !ops->read_cr ||
+                     ops->read_cr(4, &cr4, ctxt) != X86EMUL_OKAY )
+                    cr4 = 0;
+                generate_exception_if(!(cr4 & X86_CR4_PKE), EXC_UD);
+                generate_exception_if(_regs.ecx | _regs.edx, EXC_GP, 0);
+                wrpkru(_regs.eax);
+                break;
+            default:
+                goto unimplemented_insn;
+            }
+            break;
+
         case 0xf8: /* swapgs */
             generate_exception_if(!mode_64bit(), EXC_UD);
             generate_exception_if(!mode_ring0(), EXC_GP, 0);
diff --git a/xen/include/asm-x86/processor.h b/xen/include/asm-x86/processor.h
index d8d0dc8034..83143d4df8 100644
--- a/xen/include/asm-x86/processor.h
+++ b/xen/include/asm-x86/processor.h
@@ -377,6 +377,12 @@ static inline unsigned int rdpkru(void)
     return pkru;
 }
 
+static inline void wrpkru(unsigned int pkru)
+{
+    asm volatile ( ".byte 0x0f, 0x01, 0xef"
+                   :: "a" (pkru), "d" (0), "c" (0) );
+}
+
 /* Macros for PKRU domain */
 #define PKRU_READ  (0)
 #define PKRU_WRITE (1)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue May 04 08:22:09 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 May 2021 08:22:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.121981.230024 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ldqJf-0004U6-Fk; Tue, 04 May 2021 08:22:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 121981.230024; Tue, 04 May 2021 08:22:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ldqJf-0004Ty-Cl; Tue, 04 May 2021 08:22:03 +0000
Received: by outflank-mailman (input) for mailman id 121981;
 Tue, 04 May 2021 08:22:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldqJe-0004Tt-Ma
 for xen-changelog@lists.xenproject.org; Tue, 04 May 2021 08:22:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldqJe-0006IA-FY
 for xen-changelog@lists.xenproject.org; Tue, 04 May 2021 08:22:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldqJe-0004Pi-Ek
 for xen-changelog@lists.xenproject.org; Tue, 04 May 2021 08:22:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=CmWBGUdeojyAsTRDO0X6luHH3/13rDTG2H58YPNiIqA=; b=eOJhxcWN5G1jC1H/tmgQQtDL+l
	Hg6OcS5KUf/q9MOp43gjzyub+NDut3VlWQhV62nywNPU3dQUkP/IQP8jM5pWSeGZQiKVFTobFCDPE
	2XEb93LbDqueHWthHvCUZ5jPLG1Wk2PQUS+FsL4SuS9kJD6svNebOhlmKDqzD9+g8Jzo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/p2m: set_{foreign,mmio}_p2m_entry() are HVM-only
Message-Id: <E1ldqJe-0004Pi-Ek@xenbits.xenproject.org>
Date: Tue, 04 May 2021 08:22:02 +0000

commit e7f062e246ad4a4d1baac86fec92fe9fa8aae4d8
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon May 3 15:17:19 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon May 3 15:17:19 2021 +0200

    x86/p2m: set_{foreign,mmio}_p2m_entry() are HVM-only
    
    Extend a respective #ifdef from inside set_typed_p2m_entry() to around
    all three functions. Add ASSERT_UNREACHABLE() to the latter one's safety
    check path.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/mm/p2m.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
index 3840f167b0..3e356418e1 100644
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -1260,6 +1260,8 @@ int p2m_finish_type_change(struct domain *d,
     return rc;
 }
 
+#ifdef CONFIG_HVM
+
 /*
  * Returns:
  *    0              for success
@@ -1280,7 +1282,10 @@ static int set_typed_p2m_entry(struct domain *d, unsigned long gfn_l,
     struct p2m_domain *p2m = p2m_get_hostp2m(d);
 
     if ( !paging_mode_translate(d) )
+    {
+        ASSERT_UNREACHABLE();
         return -EIO;
+    }
 
     gfn_lock(p2m, gfn, order);
     omfn = p2m->get_entry(p2m, gfn, &ot, &a, 0, &cur_order, NULL);
@@ -1313,7 +1318,6 @@ static int set_typed_p2m_entry(struct domain *d, unsigned long gfn_l,
     if ( rc )
         gdprintk(XENLOG_ERR, "p2m_set_entry: %#lx:%u -> %d (0x%"PRI_mfn")\n",
                  gfn_l, order, rc, mfn_x(mfn));
-#ifdef CONFIG_HVM
     else if ( p2m_is_pod(ot) )
     {
         pod_lock(p2m);
@@ -1321,7 +1325,6 @@ static int set_typed_p2m_entry(struct domain *d, unsigned long gfn_l,
         BUG_ON(p2m->pod.entry_count < 0);
         pod_unlock(p2m);
     }
-#endif
     gfn_unlock(p2m, gfn, order);
 
     return rc;
@@ -1349,6 +1352,8 @@ int set_mmio_p2m_entry(struct domain *d, gfn_t gfn, mfn_t mfn,
                                p2m_get_hostp2m(d)->default_access);
 }
 
+#endif /* CONFIG_HVM */
+
 int set_identity_p2m_entry(struct domain *d, unsigned long gfn_l,
                            p2m_access_t p2ma, unsigned int flag)
 {
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue May 04 08:22:13 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 May 2021 08:22:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.121982.230027 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ldqJp-0004Ut-H8; Tue, 04 May 2021 08:22:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 121982.230027; Tue, 04 May 2021 08:22:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ldqJp-0004Un-EK; Tue, 04 May 2021 08:22:13 +0000
Received: by outflank-mailman (input) for mailman id 121982;
 Tue, 04 May 2021 08:22:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldqJo-0004Ue-Ku
 for xen-changelog@lists.xenproject.org; Tue, 04 May 2021 08:22:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldqJo-0006ID-K8
 for xen-changelog@lists.xenproject.org; Tue, 04 May 2021 08:22:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldqJo-0004Qk-I3
 for xen-changelog@lists.xenproject.org; Tue, 04 May 2021 08:22:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=2H3zMTNSV1NjnAWx0kKAbbtzd53ewi4CMojyPti9egE=; b=xIYLmhdeMZeim+Z56LHFHZ7xNP
	YJoww7HLzckNU2qZOWfgjNgCVYDazomcFY4ZA7Kia0/jpmpLFJGEPhK7ila/3uLkL3ccLMUg7NYkl
	Kcfu3+ZWHM7lmoFMw1vEY8ZiM24NM1hVpr8pgOSnvrvmxaM+gqJkhLJwHXMNnAx0FFn8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/p2m: {,un}map_mmio_regions() are HVM-only
Message-Id: <E1ldqJo-0004Qk-I3@xenbits.xenproject.org>
Date: Tue, 04 May 2021 08:22:12 +0000

commit a4d9fbc0d7b362d3a3d8790958178b2c9c6e2711
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon May 3 15:26:08 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon May 3 15:26:08 2021 +0200

    x86/p2m: {,un}map_mmio_regions() are HVM-only
    
    Mirror the "translated" check the functions do to do_domctl(), allowing
    the calls to be DCEd by the compiler. Add ASSERT_UNREACHABLE() to the
    original checks.
    
    Also arrange for {set,clear}_mmio_p2m_entry() and
    {set,clear}_identity_p2m_entry() to respectively live next to each
    other, such that clear_mmio_p2m_entry() can also be covered by the
    #ifdef already covering set_mmio_p2m_entry().
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/mm/p2m.c     | 106 ++++++++++++++++++++++++----------------------
 xen/common/domctl.c       |   3 ++
 xen/include/asm-x86/p2m.h |   8 ++++
 3 files changed, 67 insertions(+), 50 deletions(-)

diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
index 3e356418e1..e76d8c66d3 100644
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -1352,52 +1352,6 @@ int set_mmio_p2m_entry(struct domain *d, gfn_t gfn, mfn_t mfn,
                                p2m_get_hostp2m(d)->default_access);
 }
 
-#endif /* CONFIG_HVM */
-
-int set_identity_p2m_entry(struct domain *d, unsigned long gfn_l,
-                           p2m_access_t p2ma, unsigned int flag)
-{
-    p2m_type_t p2mt;
-    p2m_access_t a;
-    gfn_t gfn = _gfn(gfn_l);
-    mfn_t mfn;
-    struct p2m_domain *p2m = p2m_get_hostp2m(d);
-    int ret;
-
-    if ( !paging_mode_translate(p2m->domain) )
-    {
-        if ( !is_iommu_enabled(d) )
-            return 0;
-        return iommu_legacy_map(d, _dfn(gfn_l), _mfn(gfn_l),
-                                1ul << PAGE_ORDER_4K,
-                                IOMMUF_readable | IOMMUF_writable);
-    }
-
-    gfn_lock(p2m, gfn, 0);
-
-    mfn = p2m->get_entry(p2m, gfn, &p2mt, &a, 0, NULL, NULL);
-
-    if ( p2mt == p2m_invalid || p2mt == p2m_mmio_dm )
-        ret = p2m_set_entry(p2m, gfn, _mfn(gfn_l), PAGE_ORDER_4K,
-                            p2m_mmio_direct, p2ma);
-    else if ( mfn_x(mfn) == gfn_l && p2mt == p2m_mmio_direct && a == p2ma )
-        ret = 0;
-    else
-    {
-        if ( flag & XEN_DOMCTL_DEV_RDM_RELAXED )
-            ret = 0;
-        else
-            ret = -EBUSY;
-        printk(XENLOG_G_WARNING
-               "Cannot setup identity map d%d:%lx,"
-               " gfn already mapped to %lx.\n",
-               d->domain_id, gfn_l, mfn_x(mfn));
-    }
-
-    gfn_unlock(p2m, gfn, 0);
-    return ret;
-}
-
 /*
  * Returns:
  *    0        for success
@@ -1447,6 +1401,52 @@ int clear_mmio_p2m_entry(struct domain *d, unsigned long gfn_l, mfn_t mfn,
     return rc;
 }
 
+#endif /* CONFIG_HVM */
+
+int set_identity_p2m_entry(struct domain *d, unsigned long gfn_l,
+                           p2m_access_t p2ma, unsigned int flag)
+{
+    p2m_type_t p2mt;
+    p2m_access_t a;
+    gfn_t gfn = _gfn(gfn_l);
+    mfn_t mfn;
+    struct p2m_domain *p2m = p2m_get_hostp2m(d);
+    int ret;
+
+    if ( !paging_mode_translate(p2m->domain) )
+    {
+        if ( !is_iommu_enabled(d) )
+            return 0;
+        return iommu_legacy_map(d, _dfn(gfn_l), _mfn(gfn_l),
+                                1ul << PAGE_ORDER_4K,
+                                IOMMUF_readable | IOMMUF_writable);
+    }
+
+    gfn_lock(p2m, gfn, 0);
+
+    mfn = p2m->get_entry(p2m, gfn, &p2mt, &a, 0, NULL, NULL);
+
+    if ( p2mt == p2m_invalid || p2mt == p2m_mmio_dm )
+        ret = p2m_set_entry(p2m, gfn, _mfn(gfn_l), PAGE_ORDER_4K,
+                            p2m_mmio_direct, p2ma);
+    else if ( mfn_x(mfn) == gfn_l && p2mt == p2m_mmio_direct && a == p2ma )
+        ret = 0;
+    else
+    {
+        if ( flag & XEN_DOMCTL_DEV_RDM_RELAXED )
+            ret = 0;
+        else
+            ret = -EBUSY;
+        printk(XENLOG_G_WARNING
+               "Cannot setup identity map d%d:%lx,"
+               " gfn already mapped to %lx.\n",
+               d->domain_id, gfn_l, mfn_x(mfn));
+    }
+
+    gfn_unlock(p2m, gfn, 0);
+    return ret;
+}
+
 int clear_identity_p2m_entry(struct domain *d, unsigned long gfn_l)
 {
     p2m_type_t p2mt;
@@ -1892,6 +1892,8 @@ void *map_domain_gfn(struct p2m_domain *p2m, gfn_t gfn, mfn_t *mfn,
     return map_domain_page(*mfn);
 }
 
+#ifdef CONFIG_HVM
+
 static unsigned int mmio_order(const struct domain *d,
                                unsigned long start_fn, unsigned long nr)
 {
@@ -1932,7 +1934,10 @@ int map_mmio_regions(struct domain *d,
     unsigned int iter, order;
 
     if ( !paging_mode_translate(d) )
-        return 0;
+    {
+        ASSERT_UNREACHABLE();
+        return -EOPNOTSUPP;
+    }
 
     for ( iter = i = 0; i < nr && iter < MAP_MMIO_MAX_ITER;
           i += 1UL << order, ++iter )
@@ -1964,7 +1969,10 @@ int unmap_mmio_regions(struct domain *d,
     unsigned int iter, order;
 
     if ( !paging_mode_translate(d) )
-        return 0;
+    {
+        ASSERT_UNREACHABLE();
+        return -EOPNOTSUPP;
+    }
 
     for ( iter = i = 0; i < nr && iter < MAP_MMIO_MAX_ITER;
           i += 1UL << order, ++iter )
@@ -1986,8 +1994,6 @@ int unmap_mmio_regions(struct domain *d,
     return i == nr ? 0 : i ?: ret;
 }
 
-#ifdef CONFIG_HVM
-
 int altp2m_get_effective_entry(struct p2m_domain *ap2m, gfn_t gfn, mfn_t *mfn,
                                p2m_type_t *t, p2m_access_t *a,
                                bool prepopulate)
diff --git a/xen/common/domctl.c b/xen/common/domctl.c
index af044e2eda..ef202c2b8c 100644
--- a/xen/common/domctl.c
+++ b/xen/common/domctl.c
@@ -750,6 +750,9 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl)
         if ( ret )
             break;
 
+        if ( !paging_mode_translate(d) )
+            break;
+
         if ( add )
         {
             printk(XENLOG_G_DEBUG
diff --git a/xen/include/asm-x86/p2m.h b/xen/include/asm-x86/p2m.h
index 7d63f5787e..6fadeed7bd 100644
--- a/xen/include/asm-x86/p2m.h
+++ b/xen/include/asm-x86/p2m.h
@@ -658,11 +658,19 @@ int p2m_finish_type_change(struct domain *d,
 int p2m_is_logdirty_range(struct p2m_domain *, unsigned long start,
                           unsigned long end);
 
+#ifdef CONFIG_HVM
 /* Set mmio addresses in the p2m table (for pass-through) */
 int set_mmio_p2m_entry(struct domain *d, gfn_t gfn, mfn_t mfn,
                        unsigned int order);
 int clear_mmio_p2m_entry(struct domain *d, unsigned long gfn, mfn_t mfn,
                          unsigned int order);
+#else
+static inline int clear_mmio_p2m_entry(struct domain *d, unsigned long gfn,
+                                       mfn_t mfn, unsigned int order)
+{
+    return -EIO;
+}
+#endif
 
 /* Set identity addresses in the p2m table (for pass-through) */
 int set_identity_p2m_entry(struct domain *d, unsigned long gfn,
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue May 04 08:22:23 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 May 2021 08:22:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.121983.230031 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ldqJz-0004WK-Iu; Tue, 04 May 2021 08:22:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 121983.230031; Tue, 04 May 2021 08:22:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ldqJz-0004WC-Fs; Tue, 04 May 2021 08:22:23 +0000
Received: by outflank-mailman (input) for mailman id 121983;
 Tue, 04 May 2021 08:22:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldqJy-0004W3-PZ
 for xen-changelog@lists.xenproject.org; Tue, 04 May 2021 08:22:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldqJy-0006IQ-Nc
 for xen-changelog@lists.xenproject.org; Tue, 04 May 2021 08:22:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldqJy-0004RQ-MZ
 for xen-changelog@lists.xenproject.org; Tue, 04 May 2021 08:22:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=8dWJp5SSUY4JJ8ng9XKQKdmec5d4eBDwUvKzUZFRiKI=; b=M979RFIqSJ60AoTiFbsmFXjzzf
	rsA32CenvJJoiqgcbdym5oqT2mKPymHovleaGx6y9q0Fep5oWPnkGUxOZRAT2dB+RbRaWoPv7wRqh
	QNWzrGM+EvYyVGj1Zj/XGSnEBanogmwiRKQL5ekT91iMiw6zQzMmos5VYimAVa6dkls8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/mm: the gva_to_gfn() hook is HVM-only
Message-Id: <E1ldqJy-0004RQ-MZ@xenbits.xenproject.org>
Date: Tue, 04 May 2021 08:22:22 +0000

commit cb117e426f544af6af3e071249a650ecd7f88655
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon May 3 15:27:21 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon May 3 15:27:21 2021 +0200

    x86/mm: the gva_to_gfn() hook is HVM-only
    
    As is the adjacent ga_to_gfn() one as well as paging_gva_to_gfn().
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Tim Deegan <tim@xen.org>
---
 xen/arch/x86/mm/p2m.c          | 3 ++-
 xen/arch/x86/mm/shadow/multi.c | 4 ++++
 xen/arch/x86/mm/shadow/none.c  | 4 ++++
 xen/include/asm-x86/paging.h   | 6 ++++++
 4 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
index e76d8c66d3..7c3a5c8570 100644
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -1793,7 +1793,6 @@ void np2m_schedule(int dir)
         p2m_unlock(p2m);
     }
 }
-#endif
 
 unsigned long paging_gva_to_gfn(struct vcpu *v,
                                 unsigned long va,
@@ -1844,6 +1843,8 @@ unsigned long paging_gva_to_gfn(struct vcpu *v,
     return hostmode->gva_to_gfn(v, hostp2m, va, pfec);
 }
 
+#endif /* CONFIG_HVM */
+
 /*
  * If the map is non-NULL, we leave this function having acquired an extra ref
  * on mfn_to_page(*mfn).  In all cases, *pfec contains appropriate
diff --git a/xen/arch/x86/mm/shadow/multi.c b/xen/arch/x86/mm/shadow/multi.c
index ae65da439f..8bb028c2e2 100644
--- a/xen/arch/x86/mm/shadow/multi.c
+++ b/xen/arch/x86/mm/shadow/multi.c
@@ -3030,6 +3030,7 @@ static bool sh_invlpg(struct vcpu *v, unsigned long linear)
     return true;
 }
 
+#ifdef CONFIG_HVM
 
 static unsigned long
 sh_gva_to_gfn(struct vcpu *v, struct p2m_domain *p2m,
@@ -3063,6 +3064,7 @@ sh_gva_to_gfn(struct vcpu *v, struct p2m_domain *p2m,
     return gfn_x(gfn);
 }
 
+#endif /* CONFIG_HVM */
 
 static inline void
 sh_update_linear_entries(struct vcpu *v)
@@ -4183,7 +4185,9 @@ int sh_audit_l4_table(struct vcpu *v, mfn_t sl4mfn, mfn_t x)
 const struct paging_mode sh_paging_mode = {
     .page_fault                    = sh_page_fault,
     .invlpg                        = sh_invlpg,
+#ifdef CONFIG_HVM
     .gva_to_gfn                    = sh_gva_to_gfn,
+#endif
     .update_cr3                    = sh_update_cr3,
     .update_paging_modes           = shadow_update_paging_modes,
     .flush_tlb                     = shadow_flush_tlb,
diff --git a/xen/arch/x86/mm/shadow/none.c b/xen/arch/x86/mm/shadow/none.c
index 67745074c4..79889b926a 100644
--- a/xen/arch/x86/mm/shadow/none.c
+++ b/xen/arch/x86/mm/shadow/none.c
@@ -43,12 +43,14 @@ static bool _invlpg(struct vcpu *v, unsigned long linear)
     return true;
 }
 
+#ifdef CONFIG_HVM
 static unsigned long _gva_to_gfn(struct vcpu *v, struct p2m_domain *p2m,
                                  unsigned long va, uint32_t *pfec)
 {
     ASSERT_UNREACHABLE();
     return gfn_x(INVALID_GFN);
 }
+#endif
 
 static void _update_cr3(struct vcpu *v, int do_locking, bool noflush)
 {
@@ -63,7 +65,9 @@ static void _update_paging_modes(struct vcpu *v)
 static const struct paging_mode sh_paging_none = {
     .page_fault                    = _page_fault,
     .invlpg                        = _invlpg,
+#ifdef CONFIG_HVM
     .gva_to_gfn                    = _gva_to_gfn,
+#endif
     .update_cr3                    = _update_cr3,
     .update_paging_modes           = _update_paging_modes,
 };
diff --git a/xen/include/asm-x86/paging.h b/xen/include/asm-x86/paging.h
index 7332a9b506..fa22558e2e 100644
--- a/xen/include/asm-x86/paging.h
+++ b/xen/include/asm-x86/paging.h
@@ -127,6 +127,7 @@ struct paging_mode {
                                             struct cpu_user_regs *regs);
     bool          (*invlpg                )(struct vcpu *v,
                                             unsigned long linear);
+#ifdef CONFIG_HVM
     unsigned long (*gva_to_gfn            )(struct vcpu *v,
                                             struct p2m_domain *p2m,
                                             unsigned long va,
@@ -136,6 +137,7 @@ struct paging_mode {
                                             unsigned long cr3,
                                             paddr_t ga, uint32_t *pfec,
                                             unsigned int *page_order);
+#endif
     void          (*update_cr3            )(struct vcpu *v, int do_locking,
                                             bool noflush);
     void          (*update_paging_modes   )(struct vcpu *v);
@@ -287,6 +289,8 @@ unsigned long paging_gva_to_gfn(struct vcpu *v,
                                 unsigned long va,
                                 uint32_t *pfec);
 
+#ifdef CONFIG_HVM
+
 /* Translate a guest address using a particular CR3 value.  This is used
  * to by nested HAP code, to walk the guest-supplied NPT tables as if
  * they were pagetables.
@@ -305,6 +309,8 @@ static inline unsigned long paging_ga_to_gfn_cr3(struct vcpu *v,
         page_order);
 }
 
+#endif /* CONFIG_HVM */
+
 /* Update all the things that are derived from the guest's CR3.
  * Called when the guest changes CR3; the caller can then use v->arch.cr3
  * as the value to load into the host CR3 to schedule this vcpu */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue May 04 08:22:33 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 May 2021 08:22:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.121984.230036 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ldqK9-0004Xr-Kf; Tue, 04 May 2021 08:22:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 121984.230036; Tue, 04 May 2021 08:22:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ldqK9-0004Xj-Ha; Tue, 04 May 2021 08:22:33 +0000
Received: by outflank-mailman (input) for mailman id 121984;
 Tue, 04 May 2021 08:22:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldqK8-0004Xb-Rk
 for xen-changelog@lists.xenproject.org; Tue, 04 May 2021 08:22:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldqK8-0006Ir-Qj
 for xen-changelog@lists.xenproject.org; Tue, 04 May 2021 08:22:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldqK8-0004S6-Pi
 for xen-changelog@lists.xenproject.org; Tue, 04 May 2021 08:22:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=FlLynUVH2sMiq470LJE5Urw+Qtr3c+2g5t72v+GGERY=; b=CIfros3HCfbGGgdT6qVl7C+0Ix
	fFj+JXRNZLNTEtZf9LoPmuFUArIW1BNFIDaRCpOw17zmRRP1IDCQ0ZqxrClbY+y3xm2lhvMPAaSpi
	BvLNS6errVxeYonBdX9690R6vEMvIKOHI6jGgetYHFWOVQ0IOOvkePpH4ohaGKGv1oZk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] AMD/IOMMU: guest IOMMU support is for HVM only
Message-Id: <E1ldqK8-0004S6-Pi@xenbits.xenproject.org>
Date: Tue, 04 May 2021 08:22:32 +0000

commit 230a2f68159394b69b35c18844d621e8dcf5b28e
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon May 3 15:27:42 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon May 3 15:27:42 2021 +0200

    AMD/IOMMU: guest IOMMU support is for HVM only
    
    Generally all of this is dead code anyway, but there's a caller of
    guest_iommu_add_ppr_log(), and the code itself calls
    p2m_change_type_one(), which is about to become HVM-only. Hence this
    code, short of deleting it altogether, needs to become properly HVM-
    only as well.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/drivers/passthrough/amd/Makefile | 2 +-
 xen/drivers/passthrough/amd/iommu.h  | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/xen/drivers/passthrough/amd/Makefile b/xen/drivers/passthrough/amd/Makefile
index 95c04ed237..a3aecd26ef 100644
--- a/xen/drivers/passthrough/amd/Makefile
+++ b/xen/drivers/passthrough/amd/Makefile
@@ -5,4 +5,4 @@ obj-y += pci_amd_iommu.o
 obj-bin-y += iommu_acpi.init.o
 obj-y += iommu_intr.o
 obj-y += iommu_cmd.o
-obj-y += iommu_guest.o
+obj-$(CONFIG_HVM) += iommu_guest.o
diff --git a/xen/drivers/passthrough/amd/iommu.h b/xen/drivers/passthrough/amd/iommu.h
index ad089cb095..73f89f0f20 100644
--- a/xen/drivers/passthrough/amd/iommu.h
+++ b/xen/drivers/passthrough/amd/iommu.h
@@ -307,12 +307,16 @@ int __must_check amd_iommu_suspend(void);
 void amd_iommu_crash_shutdown(void);
 
 /* guest iommu support */
+#ifdef CONFIG_HVM
 void amd_iommu_send_guest_cmd(struct amd_iommu *iommu, u32 cmd[]);
 void guest_iommu_add_ppr_log(struct domain *d, u32 entry[]);
 void guest_iommu_add_event_log(struct domain *d, u32 entry[]);
 int guest_iommu_init(struct domain* d);
 void guest_iommu_destroy(struct domain *d);
 int guest_iommu_set_base(struct domain *d, uint64_t base);
+#else
+static inline void guest_iommu_add_ppr_log(struct domain *d, uint32_t entry[]) {}
+#endif
 
 static inline u32 get_field_from_reg_u32(u32 reg_value, u32 mask, u32 shift)
 {
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue May 04 08:22:43 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 May 2021 08:22:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.121985.230039 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ldqKJ-0004ZP-Mu; Tue, 04 May 2021 08:22:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 121985.230039; Tue, 04 May 2021 08:22:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ldqKJ-0004ZH-J9; Tue, 04 May 2021 08:22:43 +0000
Received: by outflank-mailman (input) for mailman id 121985;
 Tue, 04 May 2021 08:22:43 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldqKI-0004ZA-Ug
 for xen-changelog@lists.xenproject.org; Tue, 04 May 2021 08:22:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldqKI-0006Iz-Tu
 for xen-changelog@lists.xenproject.org; Tue, 04 May 2021 08:22:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldqKI-0004Sg-T8
 for xen-changelog@lists.xenproject.org; Tue, 04 May 2021 08:22:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Orr1kEZmEt9jyQNSMgrVoztB8Tu6BZCp6AGUi8/cC1E=; b=totq5Ukgo2ao1U2tWgYWpPburV
	EhLMbYHJlq3M1VO58Lo4GW9IyXiaHHLv2GyzWXE0aHh5blNd6FCiW1/OF7n4PUPZoHyb7Hd1bhZfu
	GtRaEbPVEsDzQRGlRnAvfdkfLvH5jrjU2L/t6mxRORKljgwxuX930gNJyMSxpj34iB8g=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/p2m: change_entry_type_* hooks are HVM-only
Message-Id: <E1ldqKI-0004Sg-T8@xenbits.xenproject.org>
Date: Tue, 04 May 2021 08:22:42 +0000

commit 136234f0da018390c98d4353dfe2f2934b623106
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon May 3 15:27:56 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon May 3 15:27:56 2021 +0200

    x86/p2m: change_entry_type_* hooks are HVM-only
    
    Exclude functions using them from !HVM builds, thus making it possible
    to exclude the hooks as well. Also cover the already unused
    memory_type_changed hook while inserting the #ifdef in the struct.
    
    While no respective check was there, I can't see how
    XEN_DOMCTL_set_broken_page_p2m could have been meant to work for PV the
    way it is implemented. Restrict this operation to acting on HVM guests.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/domctl.c     |  7 +++++--
 xen/arch/x86/mm/p2m-pt.c  |  8 ++++++++
 xen/arch/x86/mm/p2m.c     | 14 +++++++-------
 xen/arch/x86/mm/paging.c  |  2 ++
 xen/include/asm-x86/p2m.h |  2 ++
 5 files changed, 24 insertions(+), 9 deletions(-)

diff --git a/xen/arch/x86/domctl.c b/xen/arch/x86/domctl.c
index e440bd021e..26a76d2be9 100644
--- a/xen/arch/x86/domctl.c
+++ b/xen/arch/x86/domctl.c
@@ -1080,9 +1080,12 @@ long arch_do_domctl(
     {
         p2m_type_t pt;
         unsigned long pfn = domctl->u.set_broken_page_p2m.pfn;
-        mfn_t mfn = get_gfn_query(d, pfn, &pt);
 
-        if ( unlikely(!mfn_valid(mfn)) || unlikely(!p2m_is_ram(pt)) )
+        if ( !is_hvm_domain(d) )
+            return -EINVAL;
+
+        if ( unlikely(!mfn_valid(get_gfn_query(d, pfn, &pt))) ||
+             unlikely(!p2m_is_ram(pt)) )
             ret = -EINVAL;
         else
             ret = p2m_change_type_one(d, pfn, pt, p2m_ram_broken);
diff --git a/xen/arch/x86/mm/p2m-pt.c b/xen/arch/x86/mm/p2m-pt.c
index f2afcf49a3..4a70ee4f19 100644
--- a/xen/arch/x86/mm/p2m-pt.c
+++ b/xen/arch/x86/mm/p2m-pt.c
@@ -324,6 +324,7 @@ p2m_next_level(struct p2m_domain *p2m, void **table,
     return rc;
 }
 
+#ifdef CONFIG_HVM
 /*
  * Mark (via clearing the U flag) as needing P2M type re-calculation all valid
  * present entries at the targeted level for the passed in GFN range, which is
@@ -392,6 +393,7 @@ static int p2m_pt_set_recalc_range(struct p2m_domain *p2m,
 
     return err;
 }
+#endif /* CONFIG_HVM */
 
 /*
  * Handle possibly necessary P2M type re-calculation (U flag clear for a
@@ -930,6 +932,8 @@ pod_retry_l1:
     return (p2m_is_valid(*t) || p2m_is_any_ram(*t)) ? mfn : INVALID_MFN;
 }
 
+#ifdef CONFIG_HVM
+
 static void p2m_pt_change_entry_type_global(struct p2m_domain *p2m,
                                             p2m_type_t ot, p2m_type_t nt)
 {
@@ -1011,6 +1015,8 @@ static int p2m_pt_change_entry_type_range(struct p2m_domain *p2m,
     return err;
 }
 
+#endif /* CONFIG_HVM */
+
 #if P2M_AUDIT
 static long p2m_pt_audit_p2m(struct p2m_domain *p2m)
 {
@@ -1168,8 +1174,10 @@ void p2m_pt_init(struct p2m_domain *p2m)
     p2m->set_entry = p2m_pt_set_entry;
     p2m->get_entry = p2m_pt_get_entry;
     p2m->recalc = do_recalc;
+#ifdef CONFIG_HVM
     p2m->change_entry_type_global = p2m_pt_change_entry_type_global;
     p2m->change_entry_type_range = p2m_pt_change_entry_type_range;
+#endif
 
     /* Still too early to use paging_mode_hap(). */
     if ( hap_enabled(p2m->domain) )
diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
index 7c3a5c8570..bb3ac9c81e 100644
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -292,6 +292,8 @@ int p2m_is_logdirty_range(struct p2m_domain *p2m, unsigned long start,
     return 0;
 }
 
+#ifdef CONFIG_HVM
+
 static void change_entry_type_global(struct p2m_domain *p2m,
                                      p2m_type_t ot, p2m_type_t nt)
 {
@@ -316,7 +318,6 @@ void p2m_change_entry_type_global(struct domain *d,
 
     change_entry_type_global(hostp2m, ot, nt);
 
-#ifdef CONFIG_HVM
     if ( unlikely(altp2m_active(d)) )
     {
         unsigned int i;
@@ -331,12 +332,10 @@ void p2m_change_entry_type_global(struct domain *d,
                 p2m_unlock(altp2m);
             }
     }
-#endif
 
     p2m_unlock(hostp2m);
 }
 
-#ifdef CONFIG_HVM
 /* There's already a memory_type_changed() in asm/mtrr.h. */
 static void _memory_type_changed(struct p2m_domain *p2m)
 {
@@ -369,7 +368,8 @@ void p2m_memory_type_changed(struct domain *d)
 
     p2m_unlock(hostp2m);
 }
-#endif
+
+#endif /* CONFIG_HVM */
 
 int p2m_set_ioreq_server(struct domain *d,
                          unsigned int flags,
@@ -876,6 +876,7 @@ guest_physmap_add_page(struct domain *d, gfn_t gfn, mfn_t mfn,
 }
 
 #ifdef CONFIG_HVM
+
 int
 guest_physmap_add_entry(struct domain *d, gfn_t gfn, mfn_t mfn,
                         unsigned int page_order, p2m_type_t t)
@@ -1024,7 +1025,6 @@ out:
 
     return rc;
 }
-#endif
 
 /*
  * Modify the p2m type of a single gfn from ot to nt.
@@ -1161,7 +1161,6 @@ void p2m_change_type_range(struct domain *d,
 
     change_type_range(hostp2m, start, end, ot, nt);
 
-#ifdef CONFIG_HVM
     if ( unlikely(altp2m_active(d)) )
     {
         unsigned int i;
@@ -1176,7 +1175,6 @@ void p2m_change_type_range(struct domain *d,
                 p2m_unlock(altp2m);
             }
     }
-#endif
     hostp2m->defer_nested_flush = 0;
     if ( nestedhvm_enabled(d) )
         p2m_flush_nestedp2m(d);
@@ -1184,6 +1182,8 @@ void p2m_change_type_range(struct domain *d,
     p2m_unlock(hostp2m);
 }
 
+#endif /* CONFIG_HVM */
+
 /*
  * Finish p2m type change for gfns which are marked as need_recalc in a range.
  * Uses the current p2m's max_mapped_pfn to further clip the invalidation
diff --git a/xen/arch/x86/mm/paging.c b/xen/arch/x86/mm/paging.c
index 8bc14df943..c304c24526 100644
--- a/xen/arch/x86/mm/paging.c
+++ b/xen/arch/x86/mm/paging.c
@@ -588,6 +588,7 @@ static int paging_log_dirty_op(struct domain *d,
     return rv;
 }
 
+#ifdef CONFIG_HVM
 void paging_log_dirty_range(struct domain *d,
                            unsigned long begin_pfn,
                            unsigned long nr,
@@ -617,6 +618,7 @@ void paging_log_dirty_range(struct domain *d,
 
     guest_flush_tlb_mask(d, d->dirty_cpumask);
 }
+#endif
 
 /*
  * Callers must supply log_dirty_ops for the log dirty code to call. This
diff --git a/xen/include/asm-x86/p2m.h b/xen/include/asm-x86/p2m.h
index 6fadeed7bd..1084397ffe 100644
--- a/xen/include/asm-x86/p2m.h
+++ b/xen/include/asm-x86/p2m.h
@@ -264,6 +264,7 @@ struct p2m_domain {
     void               (*enable_hardware_log_dirty)(struct p2m_domain *p2m);
     void               (*disable_hardware_log_dirty)(struct p2m_domain *p2m);
     void               (*flush_hardware_cached_dirty)(struct p2m_domain *p2m);
+#ifdef CONFIG_HVM
     void               (*change_entry_type_global)(struct p2m_domain *p2m,
                                                    p2m_type_t ot,
                                                    p2m_type_t nt);
@@ -272,6 +273,7 @@ struct p2m_domain {
                                                   unsigned long first_gfn,
                                                   unsigned long last_gfn);
     void               (*memory_type_changed)(struct p2m_domain *p2m);
+#endif
     void               (*write_p2m_entry_pre)(struct domain *d,
                                               unsigned long gfn,
                                               l1_pgentry_t old,
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue May 04 08:22:53 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 May 2021 08:22:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.121986.230044 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ldqKT-0004am-QQ; Tue, 04 May 2021 08:22:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 121986.230044; Tue, 04 May 2021 08:22:53 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ldqKT-0004ae-My; Tue, 04 May 2021 08:22:53 +0000
Received: by outflank-mailman (input) for mailman id 121986;
 Tue, 04 May 2021 08:22:53 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldqKT-0004aX-1B
 for xen-changelog@lists.xenproject.org; Tue, 04 May 2021 08:22:53 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldqKT-0006J7-0O
 for xen-changelog@lists.xenproject.org; Tue, 04 May 2021 08:22:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldqKS-0004TR-W5
 for xen-changelog@lists.xenproject.org; Tue, 04 May 2021 08:22:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=LA1ybaAXEh7InhauKKYxkSqUeW/z0FgTn2CEltVvKCE=; b=D9JYhNfVn7S6zEIJDhNMjpRZ6u
	L2eirF+PhlSschGuGJx2uw/6/74DEfF9fTGI4QY0N4qHMpCiNOX4IJYWQljYZCmHw1z2eUBN27D15
	2n8Zvk2nu3IcPGQ3I+Os/Gmc4P/IIryhxTA+PLp9xo5PPU+fLyJNc5YUjJtBBQrknQnc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/p2m: hardware-log-dirty related hooks are HVM-only
Message-Id: <E1ldqKS-0004TR-W5@xenbits.xenproject.org>
Date: Tue, 04 May 2021 08:22:52 +0000

commit 594b263511687d27f1492f1277da729a2cc8f024
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon May 3 15:28:16 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon May 3 15:28:16 2021 +0200

    x86/p2m: hardware-log-dirty related hooks are HVM-only
    
    Exclude functions using them from !HVM builds, thus making it possible
    to exclude the hooks as well.
    
    By moving an #endif in p2m.c (instead of introducing yet another one)
    p2m_{get,set}_ioreq_server() get excluded for !HVM builds as well.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/mm/p2m.c     |  4 ++--
 xen/include/asm-x86/p2m.h | 11 ++++++++++-
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
index bb3ac9c81e..0e469369b9 100644
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -369,8 +369,6 @@ void p2m_memory_type_changed(struct domain *d)
     p2m_unlock(hostp2m);
 }
 
-#endif /* CONFIG_HVM */
-
 int p2m_set_ioreq_server(struct domain *d,
                          unsigned int flags,
                          struct ioreq_server *s)
@@ -464,6 +462,8 @@ void p2m_flush_hardware_cached_dirty(struct domain *d)
     }
 }
 
+#endif /* CONFIG_HVM */
+
 /*
  * Force a synchronous P2M TLB flush if a deferred flush is pending.
  *
diff --git a/xen/include/asm-x86/p2m.h b/xen/include/asm-x86/p2m.h
index 1084397ffe..1ed7da9473 100644
--- a/xen/include/asm-x86/p2m.h
+++ b/xen/include/asm-x86/p2m.h
@@ -261,10 +261,10 @@ struct p2m_domain {
                                     bool_t *sve);
     int                (*recalc)(struct p2m_domain *p2m,
                                  unsigned long gfn);
+#ifdef CONFIG_HVM
     void               (*enable_hardware_log_dirty)(struct p2m_domain *p2m);
     void               (*disable_hardware_log_dirty)(struct p2m_domain *p2m);
     void               (*flush_hardware_cached_dirty)(struct p2m_domain *p2m);
-#ifdef CONFIG_HVM
     void               (*change_entry_type_global)(struct p2m_domain *p2m,
                                                    p2m_type_t ot,
                                                    p2m_type_t nt);
@@ -630,6 +630,9 @@ int guest_physmap_add_page(struct domain *d, gfn_t gfn, mfn_t mfn,
 /* Set a p2m range as populate-on-demand */
 int guest_physmap_mark_populate_on_demand(struct domain *d, unsigned long gfn,
                                           unsigned int order);
+
+#ifdef CONFIG_HVM
+
 /* Enable hardware-assisted log-dirty. */
 void p2m_enable_hardware_log_dirty(struct domain *d);
 
@@ -639,6 +642,12 @@ void p2m_disable_hardware_log_dirty(struct domain *d);
 /* Flush hardware cached dirty GFNs */
 void p2m_flush_hardware_cached_dirty(struct domain *d);
 
+#else
+
+static inline void p2m_flush_hardware_cached_dirty(struct domain *d) {}
+
+#endif
+
 /* Change types across all p2m entries in a domain */
 void p2m_change_entry_type_global(struct domain *d, 
                                   p2m_type_t ot, p2m_type_t nt);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue May 04 08:23:03 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 May 2021 08:23:03 +0000
Received: from list by lists.xenproject.org with outflank-mailman.121987.230048 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ldqKd-0004dd-Re; Tue, 04 May 2021 08:23:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 121987.230048; Tue, 04 May 2021 08:23:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ldqKd-0004dV-Od; Tue, 04 May 2021 08:23:03 +0000
Received: by outflank-mailman (input) for mailman id 121987;
 Tue, 04 May 2021 08:23:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldqKd-0004dO-4A
 for xen-changelog@lists.xenproject.org; Tue, 04 May 2021 08:23:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldqKd-0006JV-3P
 for xen-changelog@lists.xenproject.org; Tue, 04 May 2021 08:23:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldqKd-0004UH-2h
 for xen-changelog@lists.xenproject.org; Tue, 04 May 2021 08:23:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=UKSKmeXpo1XDCd/ooIv0JV9kAjz4X/2Ys6DOsu7vG4I=; b=t/72g1QdnTLiWUftlnbli62gv1
	SHjjgDmosOpD/xJnJCYAmQxaNi6hlhUZkdHOLmNI7XdUKHjgsiTv0d8Wcvlbn0s/iGQxyfKzizanl
	wF/ur7GZpURTR2fLFnf6Iq+CiNFpXnraunfwY8vuIyHQAPeR8XB5ta1sOHtVk3qRyUIM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/p2m: the recalc hook is HVM-only
Message-Id: <E1ldqKd-0004UH-2h@xenbits.xenproject.org>
Date: Tue, 04 May 2021 08:23:03 +0000

commit ab305d365550a1cd91e58f8a9ff52b980f813380
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon May 3 15:28:33 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon May 3 15:28:33 2021 +0200

    x86/p2m: the recalc hook is HVM-only
    
    Exclude functions involved in its use from !HVM builds, thus making it
    possible to exclude the hook as well.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/mm/p2m-pt.c  | 2 +-
 xen/arch/x86/mm/p2m.c     | 6 ------
 xen/include/asm-x86/p2m.h | 2 +-
 3 files changed, 2 insertions(+), 8 deletions(-)

diff --git a/xen/arch/x86/mm/p2m-pt.c b/xen/arch/x86/mm/p2m-pt.c
index 4a70ee4f19..efbe5fd195 100644
--- a/xen/arch/x86/mm/p2m-pt.c
+++ b/xen/arch/x86/mm/p2m-pt.c
@@ -1173,8 +1173,8 @@ void p2m_pt_init(struct p2m_domain *p2m)
 {
     p2m->set_entry = p2m_pt_set_entry;
     p2m->get_entry = p2m_pt_get_entry;
-    p2m->recalc = do_recalc;
 #ifdef CONFIG_HVM
+    p2m->recalc = do_recalc;
     p2m->change_entry_type_global = p2m_pt_change_entry_type_global;
     p2m->change_entry_type_range = p2m_pt_change_entry_type_range;
 #endif
diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
index 0e469369b9..ad388e0802 100644
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -1182,8 +1182,6 @@ void p2m_change_type_range(struct domain *d,
     p2m_unlock(hostp2m);
 }
 
-#endif /* CONFIG_HVM */
-
 /*
  * Finish p2m type change for gfns which are marked as need_recalc in a range.
  * Uses the current p2m's max_mapped_pfn to further clip the invalidation
@@ -1234,7 +1232,6 @@ int p2m_finish_type_change(struct domain *d,
     if ( rc < 0 )
         goto out;
 
-#ifdef CONFIG_HVM
     if ( unlikely(altp2m_active(d)) )
     {
         unsigned int i;
@@ -1252,7 +1249,6 @@ int p2m_finish_type_change(struct domain *d,
                     goto out;
             }
     }
-#endif
 
  out:
     p2m_unlock(hostp2m);
@@ -1260,8 +1256,6 @@ int p2m_finish_type_change(struct domain *d,
     return rc;
 }
 
-#ifdef CONFIG_HVM
-
 /*
  * Returns:
  *    0              for success
diff --git a/xen/include/asm-x86/p2m.h b/xen/include/asm-x86/p2m.h
index 1ed7da9473..979fc83d02 100644
--- a/xen/include/asm-x86/p2m.h
+++ b/xen/include/asm-x86/p2m.h
@@ -259,9 +259,9 @@ struct p2m_domain {
                                     p2m_query_t q,
                                     unsigned int *page_order,
                                     bool_t *sve);
+#ifdef CONFIG_HVM
     int                (*recalc)(struct p2m_domain *p2m,
                                  unsigned long gfn);
-#ifdef CONFIG_HVM
     void               (*enable_hardware_log_dirty)(struct p2m_domain *p2m);
     void               (*disable_hardware_log_dirty)(struct p2m_domain *p2m);
     void               (*flush_hardware_cached_dirty)(struct p2m_domain *p2m);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue May 04 08:23:14 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 May 2021 08:23:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.121988.230052 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ldqKo-0004ey-Ta; Tue, 04 May 2021 08:23:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 121988.230052; Tue, 04 May 2021 08:23:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ldqKo-0004eq-QM; Tue, 04 May 2021 08:23:14 +0000
Received: by outflank-mailman (input) for mailman id 121988;
 Tue, 04 May 2021 08:23:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldqKn-0004eg-9H
 for xen-changelog@lists.xenproject.org; Tue, 04 May 2021 08:23:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldqKn-0006Jd-8H
 for xen-changelog@lists.xenproject.org; Tue, 04 May 2021 08:23:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldqKn-0004VE-6V
 for xen-changelog@lists.xenproject.org; Tue, 04 May 2021 08:23:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Tzmwc93/DmrrJsylWUj3FcB9UPDD0YiM8Ne/T/G8AOY=; b=tzIjCg4Sjp7B0q/0Mtc8VPuJgW
	HQFdBRF1pi7Un4pYxScyvcx/SMafHXRzTFkns8KNQXJ2rTaNT3LebS/qKu7AznTfN8ElOvvTMK8DU
	vwrWZf6DC+NXfhS9yp8lG8CC9adi96QL4lqI3xocHkTyphzoC0lAkQ3lU1oKW6PfSvWk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86: make mem-paging configurable and default it to off
Message-Id: <E1ldqKn-0004VE-6V@xenbits.xenproject.org>
Date: Tue, 04 May 2021 08:23:13 +0000

commit 936830c99dad6de757f5153206ccd334cc950bb2
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon May 3 15:28:53 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon May 3 15:28:53 2021 +0200

    x86: make mem-paging configurable and default it to off
    
    ... for being unsupported.
    
    While doing so, make the option dependent upon HVM, which really is the
    main purpose of the change.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Alexandru Isaila <aisaila@bitdefender.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/Kconfig                | 5 ++++-
 xen/arch/x86/hvm/hvm.c              | 2 ++
 xen/arch/x86/mm/Makefile            | 2 +-
 xen/arch/x86/x86_64/compat/mm.c     | 2 ++
 xen/arch/x86/x86_64/mm.c            | 2 ++
 xen/common/Kconfig                  | 3 ---
 xen/common/domain.c                 | 2 +-
 xen/common/memory.c                 | 2 +-
 xen/common/vm_event.c               | 8 ++++----
 xen/drivers/passthrough/x86/iommu.c | 3 ++-
 xen/include/asm-x86/mem_paging.h    | 6 ++++++
 xen/include/asm-x86/p2m.h           | 5 +++++
 xen/include/xen/sched.h             | 2 +-
 xen/include/xsm/dummy.h             | 2 +-
 xen/include/xsm/xsm.h               | 4 ++--
 xen/xsm/dummy.c                     | 2 +-
 xen/xsm/flask/hooks.c               | 4 ++--
 17 files changed, 37 insertions(+), 19 deletions(-)

diff --git a/xen/arch/x86/Kconfig b/xen/arch/x86/Kconfig
index 32b9f23a20..271b098fb5 100644
--- a/xen/arch/x86/Kconfig
+++ b/xen/arch/x86/Kconfig
@@ -16,7 +16,6 @@ config X86
 	select HAS_FAST_MULTIPLY
 	select HAS_IOPORTS
 	select HAS_KEXEC
-	select HAS_MEM_PAGING
 	select HAS_NS16550
 	select HAS_PASSTHROUGH
 	select HAS_PCI
@@ -255,6 +254,10 @@ config HYPERV_GUEST
 
 endif
 
+config MEM_PAGING
+	bool "Xen memory paging support (UNSUPPORTED)" if UNSUPPORTED
+	depends on HVM
+
 config MEM_SHARING
 	bool "Xen memory sharing support (UNSUPPORTED)" if UNSUPPORTED
 	depends on HVM
diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 28beacc45b..5086773e5c 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -1934,9 +1934,11 @@ int hvm_hap_nested_page_fault(paddr_t gpa, unsigned long gla,
         goto out_put_gfn;
     }
 
+#ifdef CONFIG_MEM_PAGING
     /* Check if the page has been paged out */
     if ( p2m_is_paged(p2mt) || (p2mt == p2m_ram_paging_out) )
         paged = 1;
+#endif
 
 #ifdef CONFIG_MEM_SHARING
     /* Mem sharing: if still shared on write access then its enomem */
diff --git a/xen/arch/x86/mm/Makefile b/xen/arch/x86/mm/Makefile
index 24f4ec40e0..5cc70005c9 100644
--- a/xen/arch/x86/mm/Makefile
+++ b/xen/arch/x86/mm/Makefile
@@ -5,7 +5,7 @@ obj-$(CONFIG_HVM) += altp2m.o
 obj-$(CONFIG_HVM) += guest_walk_2.o guest_walk_3.o guest_walk_4.o
 obj-$(CONFIG_SHADOW_PAGING) += guest_walk_4.o
 obj-$(CONFIG_MEM_ACCESS) += mem_access.o
-obj-y += mem_paging.o
+obj-$(CONFIG_MEM_PAGING) += mem_paging.o
 obj-$(CONFIG_MEM_SHARING) += mem_sharing.o
 obj-y += p2m.o p2m-pt.o
 obj-$(CONFIG_HVM) += p2m-ept.o p2m-pod.o
diff --git a/xen/arch/x86/x86_64/compat/mm.c b/xen/arch/x86/x86_64/compat/mm.c
index febdaa1977..215e96aba0 100644
--- a/xen/arch/x86/x86_64/compat/mm.c
+++ b/xen/arch/x86/x86_64/compat/mm.c
@@ -155,8 +155,10 @@ int compat_arch_memory_op(unsigned long cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
     case XENMEM_get_sharing_shared_pages:
         return mem_sharing_get_nr_shared_mfns();
 
+#ifdef CONFIG_MEM_PAGING
     case XENMEM_paging_op:
         return mem_paging_memop(guest_handle_cast(arg, xen_mem_paging_op_t));
+#endif
 
 #ifdef CONFIG_MEM_SHARING
     case XENMEM_sharing_op:
diff --git a/xen/arch/x86/x86_64/mm.c b/xen/arch/x86/x86_64/mm.c
index c41ce847b3..4f225da81e 100644
--- a/xen/arch/x86/x86_64/mm.c
+++ b/xen/arch/x86/x86_64/mm.c
@@ -1008,8 +1008,10 @@ long subarch_memory_op(unsigned long cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
     case XENMEM_get_sharing_shared_pages:
         return mem_sharing_get_nr_shared_mfns();
 
+#ifdef CONFIG_MEM_PAGING
     case XENMEM_paging_op:
         return mem_paging_memop(guest_handle_cast(arg, xen_mem_paging_op_t));
+#endif
 
 #ifdef CONFIG_MEM_SHARING
     case XENMEM_sharing_op:
diff --git a/xen/common/Kconfig b/xen/common/Kconfig
index b6c9827a7b..0ddd18e11a 100644
--- a/xen/common/Kconfig
+++ b/xen/common/Kconfig
@@ -43,9 +43,6 @@ config HAS_IOPORTS
 config HAS_KEXEC
 	bool
 
-config HAS_MEM_PAGING
-	bool
-
 config HAS_PDX
 	bool
 
diff --git a/xen/common/domain.c b/xen/common/domain.c
index cdda0d1f29..6b71c6d6a9 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -1096,7 +1096,7 @@ static void complete_domain_destroy(struct rcu_head *head)
     free_xenoprof_pages(d);
 #endif
 
-#ifdef CONFIG_HAS_MEM_PAGING
+#ifdef CONFIG_MEM_PAGING
     xfree(d->vm_event_paging);
 #endif
     xfree(d->vm_event_monitor);
diff --git a/xen/common/memory.c b/xen/common/memory.c
index 76b9f58478..b5c70c4b85 100644
--- a/xen/common/memory.c
+++ b/xen/common/memory.c
@@ -1856,7 +1856,7 @@ int check_get_page_from_gfn(struct domain *d, gfn_t gfn, bool readonly,
 
     page = get_page_from_gfn(d, gfn_x(gfn), &p2mt, q);
 
-#ifdef CONFIG_HAS_MEM_PAGING
+#ifdef CONFIG_MEM_PAGING
     if ( p2m_is_paging(p2mt) )
     {
         if ( page )
diff --git a/xen/common/vm_event.c b/xen/common/vm_event.c
index 44d542f23e..70ab3ba406 100644
--- a/xen/common/vm_event.c
+++ b/xen/common/vm_event.c
@@ -390,7 +390,7 @@ static int vm_event_resume(struct domain *d, struct vm_event_domain *ved)
         /* Check flags which apply only when the vCPU is paused */
         if ( atomic_read(&v->vm_event_pause_count) )
         {
-#ifdef CONFIG_HAS_MEM_PAGING
+#ifdef CONFIG_MEM_PAGING
             if ( rsp.reason == VM_EVENT_REASON_MEM_PAGING )
                 p2m_mem_paging_resume(d, &rsp);
 #endif
@@ -521,7 +521,7 @@ int __vm_event_claim_slot(struct domain *d, struct vm_event_domain *ved,
         return vm_event_grab_slot(ved, current->domain != d);
 }
 
-#ifdef CONFIG_HAS_MEM_PAGING
+#ifdef CONFIG_MEM_PAGING
 /* Registered with Xen-bound event channel for incoming notifications. */
 static void mem_paging_notification(struct vcpu *v, unsigned int port)
 {
@@ -546,7 +546,7 @@ static void mem_sharing_notification(struct vcpu *v, unsigned int port)
 /* Clean up on domain destruction */
 void vm_event_cleanup(struct domain *d)
 {
-#ifdef CONFIG_HAS_MEM_PAGING
+#ifdef CONFIG_MEM_PAGING
     if ( vm_event_check_ring(d->vm_event_paging) )
     {
         /* Destroying the wait queue head means waking up all
@@ -613,7 +613,7 @@ int vm_event_domctl(struct domain *d, struct xen_domctl_vm_event_op *vec)
 
     switch ( vec->mode )
     {
-#ifdef CONFIG_HAS_MEM_PAGING
+#ifdef CONFIG_MEM_PAGING
     case XEN_DOMCTL_VM_EVENT_OP_PAGING:
     {
         rc = -EINVAL;
diff --git a/xen/drivers/passthrough/x86/iommu.c b/xen/drivers/passthrough/x86/iommu.c
index b90bb31bfe..593cc4d6ae 100644
--- a/xen/drivers/passthrough/x86/iommu.c
+++ b/xen/drivers/passthrough/x86/iommu.c
@@ -23,6 +23,7 @@
 
 #include <asm/hvm/io.h>
 #include <asm/io_apic.h>
+#include <asm/mem_paging.h>
 #include <asm/setup.h>
 
 const struct iommu_init_ops *__initdata iommu_init_ops;
@@ -336,7 +337,7 @@ bool arch_iommu_use_permitted(const struct domain *d)
      */
     return d == dom_io ||
            (likely(!mem_sharing_enabled(d)) &&
-            likely(!vm_event_check_ring(d->vm_event_paging)) &&
+            likely(!mem_paging_enabled(d)) &&
             likely(!p2m_get_hostp2m(d)->global_logdirty));
 }
 
diff --git a/xen/include/asm-x86/mem_paging.h b/xen/include/asm-x86/mem_paging.h
index 176acafc75..d3635e96cf 100644
--- a/xen/include/asm-x86/mem_paging.h
+++ b/xen/include/asm-x86/mem_paging.h
@@ -24,6 +24,12 @@
 
 int mem_paging_memop(XEN_GUEST_HANDLE_PARAM(xen_mem_paging_op_t) arg);
 
+#ifdef CONFIG_MEM_PAGING
+# define mem_paging_enabled(d) vm_event_check_ring((d)->vm_event_paging)
+#else
+# define mem_paging_enabled(d) false
+#endif
+
 #endif /*__ASM_X86_MEM_PAGING_H__ */
 
 /*
diff --git a/xen/include/asm-x86/p2m.h b/xen/include/asm-x86/p2m.h
index 979fc83d02..b7da310f70 100644
--- a/xen/include/asm-x86/p2m.h
+++ b/xen/include/asm-x86/p2m.h
@@ -136,11 +136,16 @@ typedef unsigned int p2m_query_t;
 #define P2M_PAGEABLE_TYPES (p2m_to_mask(p2m_ram_rw) \
                             | p2m_to_mask(p2m_ram_logdirty) )
 
+#ifdef CONFIG_MEM_PAGING
 #define P2M_PAGING_TYPES (p2m_to_mask(p2m_ram_paging_out)        \
                           | p2m_to_mask(p2m_ram_paged)           \
                           | p2m_to_mask(p2m_ram_paging_in))
 
 #define P2M_PAGED_TYPES (p2m_to_mask(p2m_ram_paged))
+#else
+#define P2M_PAGING_TYPES 0
+#define P2M_PAGED_TYPES 0
+#endif
 
 /* Shared types */
 /* XXX: Sharable types could include p2m_ram_ro too, but we would need to
diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h
index cc633fdc07..3982167144 100644
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -530,7 +530,7 @@ struct domain
     struct domain *parent; /* VM fork parent */
 #endif
     /* Memory paging support */
-#ifdef CONFIG_HAS_MEM_PAGING
+#ifdef CONFIG_MEM_PAGING
     struct vm_event_domain *vm_event_paging;
 #endif
     /* VM event monitor support */
diff --git a/xen/include/xsm/dummy.h b/xen/include/xsm/dummy.h
index a6dab0c809..363c6d7798 100644
--- a/xen/include/xsm/dummy.h
+++ b/xen/include/xsm/dummy.h
@@ -592,7 +592,7 @@ static XSM_INLINE int xsm_mem_access(XSM_DEFAULT_ARG struct domain *d)
 }
 #endif
 
-#ifdef CONFIG_HAS_MEM_PAGING
+#ifdef CONFIG_MEM_PAGING
 static XSM_INLINE int xsm_mem_paging(XSM_DEFAULT_ARG struct domain *d)
 {
     XSM_ASSERT_ACTION(XSM_DM_PRIV);
diff --git a/xen/include/xsm/xsm.h b/xen/include/xsm/xsm.h
index 7bdd254420..ad3cddbf7d 100644
--- a/xen/include/xsm/xsm.h
+++ b/xen/include/xsm/xsm.h
@@ -146,7 +146,7 @@ struct xsm_operations {
     int (*mem_access) (struct domain *d);
 #endif
 
-#ifdef CONFIG_HAS_MEM_PAGING
+#ifdef CONFIG_MEM_PAGING
     int (*mem_paging) (struct domain *d);
 #endif
 
@@ -592,7 +592,7 @@ static inline int xsm_mem_access (xsm_default_t def, struct domain *d)
 }
 #endif
 
-#ifdef CONFIG_HAS_MEM_PAGING
+#ifdef CONFIG_MEM_PAGING
 static inline int xsm_mem_paging (xsm_default_t def, struct domain *d)
 {
     return xsm_ops->mem_paging(d);
diff --git a/xen/xsm/dummy.c b/xen/xsm/dummy.c
index 627f12dbff..de44b10130 100644
--- a/xen/xsm/dummy.c
+++ b/xen/xsm/dummy.c
@@ -124,7 +124,7 @@ void __init xsm_fixup_ops (struct xsm_operations *ops)
     set_to_dummy_if_null(ops, mem_access);
 #endif
 
-#ifdef CONFIG_HAS_MEM_PAGING
+#ifdef CONFIG_MEM_PAGING
     set_to_dummy_if_null(ops, mem_paging);
 #endif
 
diff --git a/xen/xsm/flask/hooks.c b/xen/xsm/flask/hooks.c
index 5a24d01f04..f1a1217c98 100644
--- a/xen/xsm/flask/hooks.c
+++ b/xen/xsm/flask/hooks.c
@@ -1256,7 +1256,7 @@ static int flask_mem_access(struct domain *d)
 }
 #endif
 
-#ifdef CONFIG_HAS_MEM_PAGING
+#ifdef CONFIG_MEM_PAGING
 static int flask_mem_paging(struct domain *d)
 {
     return current_has_perm(d, SECCLASS_DOMAIN2, DOMAIN2__MEM_PAGING);
@@ -1829,7 +1829,7 @@ static struct xsm_operations flask_ops = {
     .mem_access = flask_mem_access,
 #endif
 
-#ifdef CONFIG_HAS_MEM_PAGING
+#ifdef CONFIG_MEM_PAGING
     .mem_paging = flask_mem_paging,
 #endif
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue May 04 08:23:25 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 May 2021 08:23:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.121989.230056 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ldqKy-0004g7-VT; Tue, 04 May 2021 08:23:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 121989.230056; Tue, 04 May 2021 08:23:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ldqKy-0004fz-SE; Tue, 04 May 2021 08:23:24 +0000
Received: by outflank-mailman (input) for mailman id 121989;
 Tue, 04 May 2021 08:23:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldqKx-0004fn-CN
 for xen-changelog@lists.xenproject.org; Tue, 04 May 2021 08:23:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldqKx-0006Jo-BY
 for xen-changelog@lists.xenproject.org; Tue, 04 May 2021 08:23:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldqKx-0004XQ-Ah
 for xen-changelog@lists.xenproject.org; Tue, 04 May 2021 08:23:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=FQVmosWE1FAA8axad0U3Zeo3WufkC29Y37x5swVd5jM=; b=UjTh4KyFYzY4uZqfrXe5wQv2xN
	cAWi/K0C0QSVfd4erc9vtmn0I6bfLokzXm9pMa08xMIQpNw0ihHd5T/7gVvbHyz74aXYJbwNA19LN
	fb6xoJosytJB7BRN4ztLuD7nPFOtkXm+mjWE4vjXLzgu9BRrRw3MpzE/hK8TdbmOl3tQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/p2m: {get,set}_entry hooks and p2m-pt.c are HVM-only
Message-Id: <E1ldqKx-0004XQ-Ah@xenbits.xenproject.org>
Date: Tue, 04 May 2021 08:23:23 +0000

commit 8d012d3ddffcf9433befb756e14200c9a810f137
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon May 3 15:29:24 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon May 3 15:29:24 2021 +0200

    x86/p2m: {get,set}_entry hooks and p2m-pt.c are HVM-only
    
    With the hooks no longer needing setting, p2m_pt_init() degenerates to
    (about) nothing when !HVM. As a result, p2m-pt.c doesn't need building
    anymore in this case, as long as p2m_pt_init() has proper surrogates put
    in place.
    
    Unfortunately this means some new #ifdef-ary in p2m.c, but the mid-term
    plan there is to get rid of (almost) all of it by splitting out the then
    hopefully very few remaining non-HVM pieces.
    
    While the movement of the paging_mode_translate() check from
    p2m_remove_page() to guest_physmap_remove_page() may not be strictly
    necessary anymore (it was in an early version of this change), it looks
    more logical to live in the latter function, allowing to avoid acquiring
    the lock in the PV case. All other callers of p2m_remove_page() already
    have such a check anyway (in the altp2m case up the call stack).
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/mm/Makefile     |  4 ++--
 xen/arch/x86/mm/p2m-pt.c     |  8 --------
 xen/arch/x86/mm/p2m.c        | 28 +++++++++++++++++++++++-----
 xen/include/asm-x86/p2m.h    |  8 +++++++-
 xen/include/xen/p2m-common.h |  9 +++++++++
 5 files changed, 41 insertions(+), 16 deletions(-)

diff --git a/xen/arch/x86/mm/Makefile b/xen/arch/x86/mm/Makefile
index 5cc70005c9..b31041644f 100644
--- a/xen/arch/x86/mm/Makefile
+++ b/xen/arch/x86/mm/Makefile
@@ -7,8 +7,8 @@ obj-$(CONFIG_SHADOW_PAGING) += guest_walk_4.o
 obj-$(CONFIG_MEM_ACCESS) += mem_access.o
 obj-$(CONFIG_MEM_PAGING) += mem_paging.o
 obj-$(CONFIG_MEM_SHARING) += mem_sharing.o
-obj-y += p2m.o p2m-pt.o
-obj-$(CONFIG_HVM) += p2m-ept.o p2m-pod.o
+obj-y += p2m.o
+obj-$(CONFIG_HVM) += p2m-ept.o p2m-pod.o p2m-pt.o
 obj-y += paging.o
 
 guest_walk_%.o: guest_walk.c Makefile
diff --git a/xen/arch/x86/mm/p2m-pt.c b/xen/arch/x86/mm/p2m-pt.c
index efbe5fd195..f2afcf49a3 100644
--- a/xen/arch/x86/mm/p2m-pt.c
+++ b/xen/arch/x86/mm/p2m-pt.c
@@ -324,7 +324,6 @@ p2m_next_level(struct p2m_domain *p2m, void **table,
     return rc;
 }
 
-#ifdef CONFIG_HVM
 /*
  * Mark (via clearing the U flag) as needing P2M type re-calculation all valid
  * present entries at the targeted level for the passed in GFN range, which is
@@ -393,7 +392,6 @@ static int p2m_pt_set_recalc_range(struct p2m_domain *p2m,
 
     return err;
 }
-#endif /* CONFIG_HVM */
 
 /*
  * Handle possibly necessary P2M type re-calculation (U flag clear for a
@@ -932,8 +930,6 @@ pod_retry_l1:
     return (p2m_is_valid(*t) || p2m_is_any_ram(*t)) ? mfn : INVALID_MFN;
 }
 
-#ifdef CONFIG_HVM
-
 static void p2m_pt_change_entry_type_global(struct p2m_domain *p2m,
                                             p2m_type_t ot, p2m_type_t nt)
 {
@@ -1015,8 +1011,6 @@ static int p2m_pt_change_entry_type_range(struct p2m_domain *p2m,
     return err;
 }
 
-#endif /* CONFIG_HVM */
-
 #if P2M_AUDIT
 static long p2m_pt_audit_p2m(struct p2m_domain *p2m)
 {
@@ -1173,11 +1167,9 @@ void p2m_pt_init(struct p2m_domain *p2m)
 {
     p2m->set_entry = p2m_pt_set_entry;
     p2m->get_entry = p2m_pt_get_entry;
-#ifdef CONFIG_HVM
     p2m->recalc = do_recalc;
     p2m->change_entry_type_global = p2m_pt_change_entry_type_global;
     p2m->change_entry_type_range = p2m_pt_change_entry_type_range;
-#endif
 
     /* Still too early to use paging_mode_hap(). */
     if ( hap_enabled(p2m->domain) )
diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
index ad388e0802..64a90e5a97 100644
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -494,8 +494,10 @@ mfn_t __get_gfn_type_access(struct p2m_domain *p2m, unsigned long gfn_l,
                     p2m_type_t *t, p2m_access_t *a, p2m_query_t q,
                     unsigned int *page_order, bool_t locked)
 {
+#ifdef CONFIG_HVM
     mfn_t mfn;
     gfn_t gfn = _gfn(gfn_l);
+#endif
 
     /* Unshare makes no sense withuot populate. */
     if ( q & P2M_UNSHARE )
@@ -509,6 +511,7 @@ mfn_t __get_gfn_type_access(struct p2m_domain *p2m, unsigned long gfn_l,
         return _mfn(gfn_l);
     }
 
+#ifdef CONFIG_HVM
     if ( locked )
         /* Grab the lock here, don't release until put_gfn */
         gfn_lock(p2m, gfn, 0);
@@ -542,6 +545,7 @@ mfn_t __get_gfn_type_access(struct p2m_domain *p2m, unsigned long gfn_l,
     }
 
     return mfn;
+#endif
 }
 
 void __put_gfn(struct p2m_domain *p2m, unsigned long gfn)
@@ -620,6 +624,7 @@ struct page_info *p2m_get_page_from_gfn(
     return page;
 }
 
+#ifdef CONFIG_HVM
 /* Returns: 0 for success, -errno for failure */
 int p2m_set_entry(struct p2m_domain *p2m, gfn_t gfn, mfn_t mfn,
                   unsigned int page_order, p2m_type_t p2mt, p2m_access_t p2ma)
@@ -659,6 +664,7 @@ int p2m_set_entry(struct p2m_domain *p2m, gfn_t gfn, mfn_t mfn,
 
     return rc;
 }
+#endif
 
 mfn_t p2m_alloc_ptp(struct p2m_domain *p2m, unsigned int level)
 {
@@ -777,6 +783,8 @@ void p2m_final_teardown(struct domain *d)
     p2m_teardown_hostp2m(d);
 }
 
+#ifdef CONFIG_HVM
+
 static int __must_check
 p2m_remove_page(struct p2m_domain *p2m, gfn_t gfn, mfn_t mfn,
                 unsigned int page_order)
@@ -785,10 +793,6 @@ p2m_remove_page(struct p2m_domain *p2m, gfn_t gfn, mfn_t mfn,
     p2m_type_t t;
     p2m_access_t a;
 
-    /* IOMMU for PV guests is handled in get_page_type() and put_page(). */
-    if ( !paging_mode_translate(p2m->domain) )
-        return 0;
-
     ASSERT(gfn_locked_by_me(p2m, gfn));
     P2M_DEBUG("removing gfn=%#lx mfn=%#lx\n", gfn_x(gfn), mfn_x(mfn));
 
@@ -829,6 +833,10 @@ guest_physmap_remove_page(struct domain *d, gfn_t gfn,
     struct p2m_domain *p2m = p2m_get_hostp2m(d);
     int rc;
 
+    /* IOMMU for PV guests is handled in get_page_type() and put_page(). */
+    if ( !paging_mode_translate(d) )
+        return 0;
+
     gfn_lock(p2m, gfn, page_order);
     rc = p2m_remove_page(p2m, gfn, mfn, page_order);
     gfn_unlock(p2m, gfn, page_order);
@@ -836,6 +844,8 @@ guest_physmap_remove_page(struct domain *d, gfn_t gfn,
     return rc;
 }
 
+#endif /* CONFIG_HVM */
+
 int
 guest_physmap_add_page(struct domain *d, gfn_t gfn, mfn_t mfn,
                        unsigned int page_order)
@@ -1400,14 +1410,16 @@ int clear_mmio_p2m_entry(struct domain *d, unsigned long gfn_l, mfn_t mfn,
 int set_identity_p2m_entry(struct domain *d, unsigned long gfn_l,
                            p2m_access_t p2ma, unsigned int flag)
 {
+#ifdef CONFIG_HVM
     p2m_type_t p2mt;
     p2m_access_t a;
     gfn_t gfn = _gfn(gfn_l);
     mfn_t mfn;
     struct p2m_domain *p2m = p2m_get_hostp2m(d);
     int ret;
+#endif
 
-    if ( !paging_mode_translate(p2m->domain) )
+    if ( !paging_mode_translate(d) )
     {
         if ( !is_iommu_enabled(d) )
             return 0;
@@ -1416,6 +1428,7 @@ int set_identity_p2m_entry(struct domain *d, unsigned long gfn_l,
                                 IOMMUF_readable | IOMMUF_writable);
     }
 
+#ifdef CONFIG_HVM
     gfn_lock(p2m, gfn, 0);
 
     mfn = p2m->get_entry(p2m, gfn, &p2mt, &a, 0, NULL, NULL);
@@ -1439,16 +1452,19 @@ int set_identity_p2m_entry(struct domain *d, unsigned long gfn_l,
 
     gfn_unlock(p2m, gfn, 0);
     return ret;
+#endif
 }
 
 int clear_identity_p2m_entry(struct domain *d, unsigned long gfn_l)
 {
+#ifdef CONFIG_HVM
     p2m_type_t p2mt;
     p2m_access_t a;
     gfn_t gfn = _gfn(gfn_l);
     mfn_t mfn;
     struct p2m_domain *p2m = p2m_get_hostp2m(d);
     int ret;
+#endif
 
     if ( !paging_mode_translate(d) )
     {
@@ -1457,6 +1473,7 @@ int clear_identity_p2m_entry(struct domain *d, unsigned long gfn_l)
         return iommu_legacy_unmap(d, _dfn(gfn_l), 1ul << PAGE_ORDER_4K);
     }
 
+#ifdef CONFIG_HVM
     gfn_lock(p2m, gfn, 0);
 
     mfn = p2m->get_entry(p2m, gfn, &p2mt, &a, 0, NULL, NULL);
@@ -1476,6 +1493,7 @@ int clear_identity_p2m_entry(struct domain *d, unsigned long gfn_l)
     }
 
     return ret;
+#endif
 }
 
 #ifdef CONFIG_MEM_SHARING
diff --git a/xen/include/asm-x86/p2m.h b/xen/include/asm-x86/p2m.h
index b7da310f70..776d3bb1b5 100644
--- a/xen/include/asm-x86/p2m.h
+++ b/xen/include/asm-x86/p2m.h
@@ -251,6 +251,7 @@ struct p2m_domain {
     /* Pages used to construct the p2m */
     struct page_list_head pages;
 
+#ifdef CONFIG_HVM
     int                (*set_entry)(struct p2m_domain *p2m,
                                     gfn_t gfn,
                                     mfn_t mfn, unsigned int page_order,
@@ -264,7 +265,6 @@ struct p2m_domain {
                                     p2m_query_t q,
                                     unsigned int *page_order,
                                     bool_t *sve);
-#ifdef CONFIG_HVM
     int                (*recalc)(struct p2m_domain *p2m,
                                  unsigned long gfn);
     void               (*enable_hardware_log_dirty)(struct p2m_domain *p2m);
@@ -793,8 +793,14 @@ int __must_check p2m_set_entry(struct p2m_domain *p2m, gfn_t gfn, mfn_t mfn,
                                unsigned int page_order, p2m_type_t p2mt,
                                p2m_access_t p2ma);
 
+#if defined(CONFIG_HVM)
 /* Set up function pointers for PT implementation: only for use by p2m code */
 extern void p2m_pt_init(struct p2m_domain *p2m);
+#elif defined(CONFIG_SHADOW_PAGING)
+# define p2m_pt_init shadow_p2m_init
+#else
+static inline void p2m_pt_init(struct p2m_domain *p2m) {}
+#endif
 
 void *map_domain_gfn(struct p2m_domain *p2m, gfn_t gfn, mfn_t *mfn,
                      p2m_query_t q, uint32_t *pfec);
diff --git a/xen/include/xen/p2m-common.h b/xen/include/xen/p2m-common.h
index a322e738ef..80bac95057 100644
--- a/xen/include/xen/p2m-common.h
+++ b/xen/include/xen/p2m-common.h
@@ -8,9 +8,18 @@ int set_foreign_p2m_entry(struct domain *d, const struct domain *fd,
                           unsigned long gfn, mfn_t mfn);
 
 /* Remove a page from a domain's p2m table */
+#ifdef CONFIG_HVM
 int __must_check
 guest_physmap_remove_page(struct domain *d, gfn_t gfn, mfn_t mfn,
                           unsigned int page_order);
+#else
+static inline int
+guest_physmap_remove_page(struct domain *d, gfn_t gfn, mfn_t mfn,
+                          unsigned int page_order)
+{
+    return 0;
+}
+#endif
 
 /* Map MMIO regions in the p2m: start_gfn and nr describe the range in
  *  * the guest physical address space to map, starting from the machine
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue May 04 08:23:35 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 May 2021 08:23:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.121990.230060 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ldqL9-0004hX-34; Tue, 04 May 2021 08:23:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 121990.230060; Tue, 04 May 2021 08:23:35 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ldqL8-0004hP-W6; Tue, 04 May 2021 08:23:34 +0000
Received: by outflank-mailman (input) for mailman id 121990;
 Tue, 04 May 2021 08:23:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldqL7-0004hF-GG
 for xen-changelog@lists.xenproject.org; Tue, 04 May 2021 08:23:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldqL7-0006KC-FR
 for xen-changelog@lists.xenproject.org; Tue, 04 May 2021 08:23:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldqL7-0004YF-EW
 for xen-changelog@lists.xenproject.org; Tue, 04 May 2021 08:23:33 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=C147awC26hP5/wm76ukPrAiq0x4fCh1FpcldC8rHoSc=; b=Oo+52eZLwIyParQ4hMyzOctBNy
	1c4sBUtUTquwhOpfFStS80pdMtiWdDyC7sRkBCIKyNL5TUvUQwvZLs5swTecj4mLW2qP3IiMz0FPH
	wSLGiaX60/gyTCgVRUXMR0e0JNU1HCxUs98Y/H/5B4lT4sK3yKjCRArgZFScVEmuis6Q=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/p2m: write_p2m_entry_{pre,post} hooks are HVM-only
Message-Id: <E1ldqL7-0004YF-EW@xenbits.xenproject.org>
Date: Tue, 04 May 2021 08:23:33 +0000

commit 9b9ef2388c238a5b0d070a76a50efe696052bc52
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon May 3 15:29:49 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon May 3 15:29:49 2021 +0200

    x86/p2m: write_p2m_entry_{pre,post} hooks are HVM-only
    
    Move respective shadow code to its HVM-only source file, thus making it
    possible to exclude the hooks as well. This then shows that
    shadow_p2m_init() also isn't needed in !HVM builds.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Tim Deegan <tim@xen.org>
---
 xen/arch/x86/mm/shadow/common.c | 136 ----------------------------------------
 xen/arch/x86/mm/shadow/hvm.c    | 136 ++++++++++++++++++++++++++++++++++++++++
 xen/include/asm-x86/p2m.h       |   4 +-
 3 files changed, 137 insertions(+), 139 deletions(-)

diff --git a/xen/arch/x86/mm/shadow/common.c b/xen/arch/x86/mm/shadow/common.c
index 72d3816fcc..b060ebcb72 100644
--- a/xen/arch/x86/mm/shadow/common.c
+++ b/xen/arch/x86/mm/shadow/common.c
@@ -2289,22 +2289,6 @@ void shadow_prepare_page_type_change(struct domain *d, struct page_info *page,
     shadow_remove_all_shadows(d, page_to_mfn(page));
 }
 
-static void
-sh_remove_all_shadows_and_parents(struct domain *d, mfn_t gmfn)
-/* Even harsher: this is a HVM page that we thing is no longer a pagetable.
- * Unshadow it, and recursively unshadow pages that reference it. */
-{
-    sh_remove_shadows(d, gmfn, 0, 1);
-    /* XXX TODO:
-     * Rework this hashtable walker to return a linked-list of all
-     * the shadows it modified, then do breadth-first recursion
-     * to find the way up to higher-level tables and unshadow them too.
-     *
-     * The current code (just tearing down each page's shadows as we
-     * detect that it is not a pagetable) is correct, but very slow.
-     * It means extra emulated writes and slows down removal of mappings. */
-}
-
 /**************************************************************************/
 
 /* Reset the up-pointers of every L3 shadow to 0.
@@ -3031,126 +3015,6 @@ static int shadow_test_disable(struct domain *d)
     return ret;
 }
 
-/**************************************************************************/
-/* P2M map manipulations */
-
-/* shadow specific code which should be called when P2M table entry is updated
- * with new content. It is responsible for update the entry, as well as other
- * shadow processing jobs.
- */
-
-static void sh_unshadow_for_p2m_change(struct domain *d, unsigned long gfn,
-                                       l1_pgentry_t old, l1_pgentry_t new,
-                                       unsigned int level)
-{
-    mfn_t omfn = l1e_get_mfn(old);
-    unsigned int oflags = l1e_get_flags(old);
-    p2m_type_t p2mt = p2m_flags_to_type(oflags);
-    bool flush = false;
-
-    /*
-     * If there are any shadows, update them.  But if shadow_teardown()
-     * has already been called then it's not safe to try.
-     */
-    if ( unlikely(!d->arch.paging.shadow.total_pages) )
-        return;
-
-    switch ( level )
-    {
-    default:
-        /*
-         * The following assertion is to make sure we don't step on 1GB host
-         * page support of HVM guest.
-         */
-        ASSERT(!((oflags & _PAGE_PRESENT) && (oflags & _PAGE_PSE)));
-        break;
-
-    /* If we're removing an MFN from the p2m, remove it from the shadows too */
-    case 1:
-        if ( (p2m_is_valid(p2mt) || p2m_is_grant(p2mt)) && mfn_valid(omfn) )
-        {
-            sh_remove_all_shadows_and_parents(d, omfn);
-            if ( sh_remove_all_mappings(d, omfn, _gfn(gfn)) )
-                flush = true;
-        }
-        break;
-
-    /*
-     * If we're removing a superpage mapping from the p2m, we need to check
-     * all the pages covered by it.  If they're still there in the new
-     * scheme, that's OK, but otherwise they must be unshadowed.
-     */
-    case 2:
-        if ( !(oflags & _PAGE_PRESENT) || !(oflags & _PAGE_PSE) )
-            break;
-
-        if ( p2m_is_valid(p2mt) && mfn_valid(omfn) )
-        {
-            unsigned int i;
-            mfn_t nmfn = l1e_get_mfn(new);
-            l1_pgentry_t *npte = NULL;
-
-            /* If we're replacing a superpage with a normal L1 page, map it */
-            if ( (l1e_get_flags(new) & _PAGE_PRESENT) &&
-                 !(l1e_get_flags(new) & _PAGE_PSE) &&
-                 mfn_valid(nmfn) )
-                npte = map_domain_page(nmfn);
-
-            gfn &= ~(L1_PAGETABLE_ENTRIES - 1);
-
-            for ( i = 0; i < L1_PAGETABLE_ENTRIES; i++ )
-            {
-                if ( !npte ||
-                     !p2m_is_ram(p2m_flags_to_type(l1e_get_flags(npte[i]))) ||
-                     !mfn_eq(l1e_get_mfn(npte[i]), omfn) )
-                {
-                    /* This GFN->MFN mapping has gone away */
-                    sh_remove_all_shadows_and_parents(d, omfn);
-                    if ( sh_remove_all_mappings(d, omfn, _gfn(gfn + i)) )
-                        flush = true;
-                }
-                omfn = mfn_add(omfn, 1);
-            }
-
-            if ( npte )
-                unmap_domain_page(npte);
-        }
-
-        break;
-    }
-
-    if ( flush )
-        guest_flush_tlb_mask(d, d->dirty_cpumask);
-}
-
-#if (SHADOW_OPTIMIZATIONS & SHOPT_FAST_FAULT_PATH)
-static void
-sh_write_p2m_entry_post(struct p2m_domain *p2m, unsigned int oflags)
-{
-    struct domain *d = p2m->domain;
-
-    /* If we're doing FAST_FAULT_PATH, then shadow mode may have
-       cached the fact that this is an mmio region in the shadow
-       page tables.  Blow the tables away to remove the cache.
-       This is pretty heavy handed, but this is a rare operation
-       (it might happen a dozen times during boot and then never
-       again), so it doesn't matter too much. */
-    if ( d->arch.paging.shadow.has_fast_mmio_entries )
-    {
-        shadow_blow_tables(d);
-        d->arch.paging.shadow.has_fast_mmio_entries = false;
-    }
-}
-#else
-# define sh_write_p2m_entry_post NULL
-#endif
-
-void shadow_p2m_init(struct p2m_domain *p2m)
-{
-    p2m->write_p2m_entry_pre  = sh_unshadow_for_p2m_change;
-    p2m->write_p2m_entry_post = sh_write_p2m_entry_post;
-}
-
 /**************************************************************************/
 /* Log-dirty mode support */
 
diff --git a/xen/arch/x86/mm/shadow/hvm.c b/xen/arch/x86/mm/shadow/hvm.c
index 7f98286385..d5f42102a0 100644
--- a/xen/arch/x86/mm/shadow/hvm.c
+++ b/xen/arch/x86/mm/shadow/hvm.c
@@ -773,6 +773,142 @@ void sh_destroy_monitor_table(const struct vcpu *v, mfn_t mmfn,
     shadow_free(d, mmfn);
 }
 
+/**************************************************************************/
+/* P2M map manipulations */
+
+/* shadow specific code which should be called when P2M table entry is updated
+ * with new content. It is responsible for update the entry, as well as other
+ * shadow processing jobs.
+ */
+
+static void
+sh_remove_all_shadows_and_parents(struct domain *d, mfn_t gmfn)
+/* Even harsher: this is a HVM page that we thing is no longer a pagetable.
+ * Unshadow it, and recursively unshadow pages that reference it. */
+{
+    sh_remove_shadows(d, gmfn, 0, 1);
+    /* XXX TODO:
+     * Rework this hashtable walker to return a linked-list of all
+     * the shadows it modified, then do breadth-first recursion
+     * to find the way up to higher-level tables and unshadow them too.
+     *
+     * The current code (just tearing down each page's shadows as we
+     * detect that it is not a pagetable) is correct, but very slow.
+     * It means extra emulated writes and slows down removal of mappings. */
+}
+
+static void sh_unshadow_for_p2m_change(struct domain *d, unsigned long gfn,
+                                       l1_pgentry_t old, l1_pgentry_t new,
+                                       unsigned int level)
+{
+    mfn_t omfn = l1e_get_mfn(old);
+    unsigned int oflags = l1e_get_flags(old);
+    p2m_type_t p2mt = p2m_flags_to_type(oflags);
+    bool flush = false;
+
+    /*
+     * If there are any shadows, update them.  But if shadow_teardown()
+     * has already been called then it's not safe to try.
+     */
+    if ( unlikely(!d->arch.paging.shadow.total_pages) )
+        return;
+
+    switch ( level )
+    {
+    default:
+        /*
+         * The following assertion is to make sure we don't step on 1GB host
+         * page support of HVM guest.
+         */
+        ASSERT(!((oflags & _PAGE_PRESENT) && (oflags & _PAGE_PSE)));
+        break;
+
+    /* If we're removing an MFN from the p2m, remove it from the shadows too */
+    case 1:
+        if ( (p2m_is_valid(p2mt) || p2m_is_grant(p2mt)) && mfn_valid(omfn) )
+        {
+            sh_remove_all_shadows_and_parents(d, omfn);
+            if ( sh_remove_all_mappings(d, omfn, _gfn(gfn)) )
+                flush = true;
+        }
+        break;
+
+    /*
+     * If we're removing a superpage mapping from the p2m, we need to check
+     * all the pages covered by it.  If they're still there in the new
+     * scheme, that's OK, but otherwise they must be unshadowed.
+     */
+    case 2:
+        if ( !(oflags & _PAGE_PRESENT) || !(oflags & _PAGE_PSE) )
+            break;
+
+        if ( p2m_is_valid(p2mt) && mfn_valid(omfn) )
+        {
+            unsigned int i;
+            mfn_t nmfn = l1e_get_mfn(new);
+            l1_pgentry_t *npte = NULL;
+
+            /* If we're replacing a superpage with a normal L1 page, map it */
+            if ( (l1e_get_flags(new) & _PAGE_PRESENT) &&
+                 !(l1e_get_flags(new) & _PAGE_PSE) &&
+                 mfn_valid(nmfn) )
+                npte = map_domain_page(nmfn);
+
+            gfn &= ~(L1_PAGETABLE_ENTRIES - 1);
+
+            for ( i = 0; i < L1_PAGETABLE_ENTRIES; i++ )
+            {
+                if ( !npte ||
+                     !p2m_is_ram(p2m_flags_to_type(l1e_get_flags(npte[i]))) ||
+                     !mfn_eq(l1e_get_mfn(npte[i]), omfn) )
+                {
+                    /* This GFN->MFN mapping has gone away */
+                    sh_remove_all_shadows_and_parents(d, omfn);
+                    if ( sh_remove_all_mappings(d, omfn, _gfn(gfn + i)) )
+                        flush = true;
+                }
+                omfn = mfn_add(omfn, 1);
+            }
+
+            if ( npte )
+                unmap_domain_page(npte);
+        }
+
+        break;
+    }
+
+    if ( flush )
+        guest_flush_tlb_mask(d, d->dirty_cpumask);
+}
+
+#if (SHADOW_OPTIMIZATIONS & SHOPT_FAST_FAULT_PATH)
+static void
+sh_write_p2m_entry_post(struct p2m_domain *p2m, unsigned int oflags)
+{
+    struct domain *d = p2m->domain;
+
+    /* If we're doing FAST_FAULT_PATH, then shadow mode may have
+       cached the fact that this is an mmio region in the shadow
+       page tables.  Blow the tables away to remove the cache.
+       This is pretty heavy handed, but this is a rare operation
+       (it might happen a dozen times during boot and then never
+       again), so it doesn't matter too much. */
+    if ( d->arch.paging.shadow.has_fast_mmio_entries )
+    {
+        shadow_blow_tables(d);
+        d->arch.paging.shadow.has_fast_mmio_entries = false;
+    }
+}
+#else
+# define sh_write_p2m_entry_post NULL
+#endif
+
+void shadow_p2m_init(struct p2m_domain *p2m)
+{
+    p2m->write_p2m_entry_pre  = sh_unshadow_for_p2m_change;
+    p2m->write_p2m_entry_post = sh_write_p2m_entry_post;
+}
+
 /**************************************************************************/
 /* VRAM dirty tracking support */
 int shadow_track_dirty_vram(struct domain *d,
diff --git a/xen/include/asm-x86/p2m.h b/xen/include/asm-x86/p2m.h
index 776d3bb1b5..f33ae2327d 100644
--- a/xen/include/asm-x86/p2m.h
+++ b/xen/include/asm-x86/p2m.h
@@ -278,7 +278,6 @@ struct p2m_domain {
                                                   unsigned long first_gfn,
                                                   unsigned long last_gfn);
     void               (*memory_type_changed)(struct p2m_domain *p2m);
-#endif
     void               (*write_p2m_entry_pre)(struct domain *d,
                                               unsigned long gfn,
                                               l1_pgentry_t old,
@@ -286,6 +285,7 @@ struct p2m_domain {
                                               unsigned int level);
     void               (*write_p2m_entry_post)(struct p2m_domain *p2m,
                                                unsigned int oflags);
+#endif
 #if P2M_AUDIT
     long               (*audit_p2m)(struct p2m_domain *p2m);
 #endif
@@ -796,8 +796,6 @@ int __must_check p2m_set_entry(struct p2m_domain *p2m, gfn_t gfn, mfn_t mfn,
 #if defined(CONFIG_HVM)
 /* Set up function pointers for PT implementation: only for use by p2m code */
 extern void p2m_pt_init(struct p2m_domain *p2m);
-#elif defined(CONFIG_SHADOW_PAGING)
-# define p2m_pt_init shadow_p2m_init
 #else
 static inline void p2m_pt_init(struct p2m_domain *p2m) {}
 #endif
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue May 04 08:23:45 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 May 2021 08:23:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.121991.230064 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ldqLJ-0004jB-4j; Tue, 04 May 2021 08:23:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 121991.230064; Tue, 04 May 2021 08:23:45 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ldqLJ-0004j3-1T; Tue, 04 May 2021 08:23:45 +0000
Received: by outflank-mailman (input) for mailman id 121991;
 Tue, 04 May 2021 08:23:43 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldqLH-0004it-K4
 for xen-changelog@lists.xenproject.org; Tue, 04 May 2021 08:23:43 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldqLH-0006KI-JK
 for xen-changelog@lists.xenproject.org; Tue, 04 May 2021 08:23:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldqLH-0004Yv-Hr
 for xen-changelog@lists.xenproject.org; Tue, 04 May 2021 08:23:43 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=bX9JWsC86SuUYdUEn4FWy6iLVoDa5Rc4trPGyyWdfQA=; b=osX9Zn2lUfysbVQ5J3x5QN06NL
	DrLgQsgx0WZ2VjmBwMC0sdZsLhpNXIWNOMo644feH7e9tcjdtMuHKpI8580SIm41c7AnyEOcc/834
	YY47Ucze4gjHXjm3okGXdT4SwFvthTl0/Z2eR9rkS/fkfiWUke8I+uHOBt+kUhFrb2cY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/p2m: re-arrange struct p2m_domain
Message-Id: <E1ldqLH-0004Yv-Hr@xenbits.xenproject.org>
Date: Tue, 04 May 2021 08:23:43 +0000

commit 7191b808b0c2cb635f77bd4be34608cb0299a33d
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon May 3 15:30:16 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon May 3 15:30:16 2021 +0200

    x86/p2m: re-arrange struct p2m_domain
    
    Combine two HVM-specific sections in two cases (i.e. going from four of
    them to just two). Make defer_nested_flush bool and HVM-only, moving it
    next to other nested stuff. Move default_access up into a padding hole.
    
    When moving them anyway, also adjust comment style.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/mm/p2m.c     |  4 +--
 xen/include/asm-x86/p2m.h | 62 +++++++++++++++++++++++++----------------------
 2 files changed, 35 insertions(+), 31 deletions(-)

diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
index 64a90e5a97..8f4816c414 100644
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -1167,7 +1167,7 @@ void p2m_change_type_range(struct domain *d,
     ASSERT(p2m_is_changeable(ot) && p2m_is_changeable(nt));
 
     p2m_lock(hostp2m);
-    hostp2m->defer_nested_flush = 1;
+    hostp2m->defer_nested_flush = true;
 
     change_type_range(hostp2m, start, end, ot, nt);
 
@@ -1185,7 +1185,7 @@ void p2m_change_type_range(struct domain *d,
                 p2m_unlock(altp2m);
             }
     }
-    hostp2m->defer_nested_flush = 0;
+    hostp2m->defer_nested_flush = false;
     if ( nestedhvm_enabled(d) )
         p2m_flush_nestedp2m(d);
 
diff --git a/xen/include/asm-x86/p2m.h b/xen/include/asm-x86/p2m.h
index f33ae2327d..5b697df573 100644
--- a/xen/include/asm-x86/p2m.h
+++ b/xen/include/asm-x86/p2m.h
@@ -216,20 +216,15 @@ struct p2m_domain {
 
     p2m_class_t       p2m_class; /* host/nested/alternate */
 
-#ifdef CONFIG_HVM
-    /* Nested p2ms only: nested p2m base value that this p2m shadows.
-     * This can be cleared to P2M_BASE_EADDR under the per-p2m lock but
-     * needs both the per-p2m lock and the per-domain nestedp2m lock
-     * to set it to any other value. */
-#define P2M_BASE_EADDR     (~0ULL)
-    uint64_t           np2m_base;
-    uint64_t           np2m_generation;
+    /*
+     * Default P2M access type for each page in the the domain: new pages,
+     * swapped in pages, cleared pages, and pages that are ambiguously
+     * retyped get this access type.  See definition of p2m_access_t.
+     */
+    p2m_access_t default_access;
 
-    /* Nested p2ms: linked list of n2pms allocated to this domain. 
-     * The host p2m hasolds the head of the list and the np2ms are 
-     * threaded on in LRU order. */
-    struct list_head   np2m_list;
-#endif
+    /* Pages used to construct the p2m */
+    struct page_list_head pages;
 
     /* Host p2m: Log-dirty ranges registered for the domain. */
     struct rangeset   *logdirty_ranges;
@@ -237,21 +232,10 @@ struct p2m_domain {
     /* Host p2m: Global log-dirty mode enabled for the domain. */
     bool               global_logdirty;
 
-    /* Host p2m: when this flag is set, don't flush all the nested-p2m 
-     * tables on every host-p2m change.  The setter of this flag 
-     * is responsible for performing the full flush before releasing the
-     * host p2m's lock. */
-    int                defer_nested_flush;
-
 #ifdef CONFIG_HVM
     /* Alternate p2m: count of vcpu's currently using this p2m. */
     atomic_t           active_vcpus;
-#endif
-
-    /* Pages used to construct the p2m */
-    struct page_list_head pages;
 
-#ifdef CONFIG_HVM
     int                (*set_entry)(struct p2m_domain *p2m,
                                     gfn_t gfn,
                                     mfn_t mfn, unsigned int page_order,
@@ -306,11 +290,6 @@ struct p2m_domain {
     unsigned int defer_flush;
     bool_t need_flush;
 
-    /* Default P2M access type for each page in the the domain: new pages,
-     * swapped in pages, cleared pages, and pages that are ambiguously
-     * retyped get this access type.  See definition of p2m_access_t. */
-    p2m_access_t default_access;
-
     /* If true, and an access fault comes in and there is no vm_event listener, 
      * pause domain.  Otherwise, remove access restrictions. */
     bool_t       access_required;
@@ -357,6 +336,31 @@ struct p2m_domain {
         mm_lock_t        lock;         /* Locking of private pod structs,   *
                                         * not relying on the p2m lock.      */
     } pod;
+
+    /*
+     * Host p2m: when this flag is set, don't flush all the nested-p2m
+     * tables on every host-p2m change.  The setter of this flag
+     * is responsible for performing the full flush before releasing the
+     * host p2m's lock.
+     */
+    bool               defer_nested_flush;
+
+    /*
+     * Nested p2ms only: nested p2m base value that this p2m shadows.
+     * This can be cleared to P2M_BASE_EADDR under the per-p2m lock but
+     * needs both the per-p2m lock and the per-domain nestedp2m lock
+     * to set it to any other value.
+     */
+#define P2M_BASE_EADDR     (~0ULL)
+    uint64_t           np2m_base;
+    uint64_t           np2m_generation;
+
+    /*
+     * Nested p2ms: linked list of n2pms allocated to this domain.
+     * The host p2m hasolds the head of the list and the np2ms are
+     * threaded on in LRU order.
+     */
+    struct list_head   np2m_list;
 #endif
 
     union {
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue May 04 08:23:55 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 May 2021 08:23:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.121992.230068 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ldqLT-0004kT-6Q; Tue, 04 May 2021 08:23:55 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 121992.230068; Tue, 04 May 2021 08:23:55 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ldqLT-0004kL-34; Tue, 04 May 2021 08:23:55 +0000
Received: by outflank-mailman (input) for mailman id 121992;
 Tue, 04 May 2021 08:23:53 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldqLR-0004k7-N6
 for xen-changelog@lists.xenproject.org; Tue, 04 May 2021 08:23:53 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldqLR-0006KP-MJ
 for xen-changelog@lists.xenproject.org; Tue, 04 May 2021 08:23:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldqLR-0004Zj-LY
 for xen-changelog@lists.xenproject.org; Tue, 04 May 2021 08:23:53 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=nvk8RfPR+MhaiNgdgqLeMo3eCnlYmfq7X5pjPFtv58g=; b=ieSbk5AS6u7rsvmKv7fxWq+O1l
	AfQyxccoEVK0ChdREhIbWW3eOAxAYmxrZ7YnXFExr+/MC+A1LBN/s6T0/2HT3aDw5DUiU8UwJmpky
	3/liN99ALRnDr2ktqBRxr2F+dcPjO5+G0sB3AuH+pHd/PgDeYeFWeljJtv9iGHWk13Bs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] iommu: move iommu_update_ire_from_msi() to xen/iommu.h
Message-Id: <E1ldqLR-0004Zj-LY@xenbits.xenproject.org>
Date: Tue, 04 May 2021 08:23:53 +0000

commit 705f7b55be551b9d39b5ab52689a330d73f9c8eb
Author:     Rahul Singh <rahul.singh@arm.com>
AuthorDate: Mon May 3 15:30:57 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon May 3 15:30:57 2021 +0200

    iommu: move iommu_update_ire_from_msi() to xen/iommu.h
    
    Move iommu_update_ire_from_msi(..) from passthrough/pci.c to
    xen/iommu.h and wrap it under CONFIG_X86 as it is referenced in x86
    code only to avoid compilation error for other architecture when
    HAS_PCI is enabled.
    
    No functional change intended.
    
    Signed-off-by: Rahul Singh <rahul.singh@arm.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/drivers/passthrough/pci.c |  7 -------
 xen/include/xen/iommu.h       | 13 ++++++++++---
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/xen/drivers/passthrough/pci.c b/xen/drivers/passthrough/pci.c
index 705137f8be..199ce08612 100644
--- a/xen/drivers/passthrough/pci.c
+++ b/xen/drivers/passthrough/pci.c
@@ -1303,13 +1303,6 @@ static int __init setup_dump_pcidevs(void)
 }
 __initcall(setup_dump_pcidevs);
 
-int iommu_update_ire_from_msi(
-    struct msi_desc *msi_desc, struct msi_msg *msg)
-{
-    return iommu_intremap
-           ? iommu_call(&iommu_ops, update_ire_from_msi, msi_desc, msg) : 0;
-}
-
 static int iommu_add_device(struct pci_dev *pdev)
 {
     const struct domain_iommu *hd;
diff --git a/xen/include/xen/iommu.h b/xen/include/xen/iommu.h
index 4f0e5ac622..460755df29 100644
--- a/xen/include/xen/iommu.h
+++ b/xen/include/xen/iommu.h
@@ -187,8 +187,6 @@ void free_hvm_irq_dpci(struct hvm_irq_dpci *dpci);
 struct msi_desc;
 struct msi_msg;
 
-int iommu_update_ire_from_msi(struct msi_desc *msi_desc, struct msi_msg *msg);
-
 #define PT_IRQ_TIME_OUT MILLISECS(8)
 #endif /* HAS_PCI */
 
@@ -238,7 +236,6 @@ struct iommu_ops {
                            u8 devfn, device_t *dev);
 #ifdef CONFIG_HAS_PCI
     int (*get_device_group_id)(u16 seg, u8 bus, u8 devfn);
-    int (*update_ire_from_msi)(struct msi_desc *msi_desc, struct msi_msg *msg);
 #endif /* HAS_PCI */
 
     void (*teardown)(struct domain *d);
@@ -267,6 +264,7 @@ struct iommu_ops {
     int (*adjust_irq_affinities)(void);
     void (*sync_cache)(const void *addr, unsigned int size);
     void (*clear_root_pgtable)(struct domain *d);
+    int (*update_ire_from_msi)(struct msi_desc *msi_desc, struct msi_msg *msg);
 #endif /* CONFIG_X86 */
 
     int __must_check (*suspend)(void);
@@ -374,6 +372,15 @@ extern struct page_list_head iommu_pt_cleanup_list;
 
 bool arch_iommu_use_permitted(const struct domain *d);
 
+#ifdef CONFIG_X86
+static inline int iommu_update_ire_from_msi(
+    struct msi_desc *msi_desc, struct msi_msg *msg)
+{
+    return iommu_intremap
+           ? iommu_call(&iommu_ops, update_ire_from_msi, msi_desc, msg) : 0;
+}
+#endif
+
 #endif /* _IOMMU_H_ */
 
 /*
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue May 04 08:24:05 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 May 2021 08:24:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.121993.230071 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ldqLd-0004ll-87; Tue, 04 May 2021 08:24:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 121993.230071; Tue, 04 May 2021 08:24:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ldqLd-0004lf-4h; Tue, 04 May 2021 08:24:05 +0000
Received: by outflank-mailman (input) for mailman id 121993;
 Tue, 04 May 2021 08:24:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldqLb-0004lR-Qq
 for xen-changelog@lists.xenproject.org; Tue, 04 May 2021 08:24:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldqLb-0006Km-Q1
 for xen-changelog@lists.xenproject.org; Tue, 04 May 2021 08:24:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldqLb-0004ai-PK
 for xen-changelog@lists.xenproject.org; Tue, 04 May 2021 08:24:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=rRoNatKjskSGewmgbCkozv+vtrDpHuVQcZNWcW+mndA=; b=1aF+JGcHXAycUSI3TxbiZFpGSW
	At5FKHcG9WCYBAc3ZYb+/1GkMpVZIJXNRab9K1NFNYPnoje+PR8Js/zMzXVORlRrq4+f/jAVvTeRx
	uVkoiV2S9U/pOS5V1PhCJ4SPvRjrtk8hu8GEKu5v4GCDcfr7+tzZ+8KnSaEqYgO2PQio=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86emul: support RDPKRU/WRPKRU
Message-Id: <E1ldqLb-0004ai-PK@xenbits.xenproject.org>
Date: Tue, 04 May 2021 08:24:03 +0000

commit d26c277826dbbd64b3e3cb57159e1ecbfad33bc8
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon May 3 15:31:43 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon May 3 15:31:43 2021 +0200

    x86emul: support RDPKRU/WRPKRU
    
    Since we support PKU for HVM guests, the respective insns should also be
    recognized by the emulator.
    
    In emul_test_read_cr() instead of further extending the comment to
    explain the hex numbers, switch to using X86_CR4_* values.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/tests/x86_emulator/test_x86_emulator.c | 17 ++++++++++++++
 tools/tests/x86_emulator/x86-emulate.c       | 16 ++++++++++++--
 xen/arch/x86/x86_emulate/x86_emulate.c       | 33 ++++++++++++++++++++++++++++
 xen/include/asm-x86/processor.h              |  6 +++++
 4 files changed, 70 insertions(+), 2 deletions(-)

diff --git a/tools/tests/x86_emulator/test_x86_emulator.c b/tools/tests/x86_emulator/test_x86_emulator.c
index cbb8f34f58..9677476db0 100644
--- a/tools/tests/x86_emulator/test_x86_emulator.c
+++ b/tools/tests/x86_emulator/test_x86_emulator.c
@@ -2399,6 +2399,23 @@ int main(int argc, char **argv)
         goto fail;
     printf("okay\n");
 
+    printf("%-40s", "Testing rdpkru / wrpkru...");
+    instr[0] = 0x0f; instr[1] = 0x01;
+    regs.ecx = 0;
+    for ( i = 0, j = (uint32_t)-__LINE__; i < 3; ++i )
+    {
+        instr[2] = 0xee | (i & 1);
+        regs.eax = i < 2 ? j : 0;
+        regs.edx = i & 1 ? 0 : j;
+        regs.eip = (unsigned long)&instr[0];
+        rc = x86_emulate(&ctxt, &emulops);
+        if ( (rc != X86EMUL_OKAY) ||
+             (!(i & 1) && (regs.eax != (i ? j : 0) || regs.edx)) ||
+             (regs.eip != (unsigned long)&instr[3]) )
+            goto fail;
+    }
+    printf("okay\n");
+
     printf("%-40s", "Testing movdiri %edx,(%ecx)...");
     if ( stack_exec && cpu_has_movdiri )
     {
diff --git a/tools/tests/x86_emulator/x86-emulate.c b/tools/tests/x86_emulator/x86-emulate.c
index fb34933e82..07f892dbbb 100644
--- a/tools/tests/x86_emulator/x86-emulate.c
+++ b/tools/tests/x86_emulator/x86-emulate.c
@@ -184,8 +184,8 @@ int emul_test_read_cr(
         return X86EMUL_OKAY;
 
     case 4:
-        /* OSFXSR, OSXMMEXCPT, and maybe OSXSAVE */
-        *val = 0x00000600 | (cpu_has_xsave ? 0x00040000 : 0);
+        *val = X86_CR4_OSFXSR | X86_CR4_OSXMMEXCPT | X86_CR4_PKE |
+               (cpu_has_xsave ? X86_CR4_OSXSAVE : 0);
         return X86EMUL_OKAY;
     }
 
@@ -256,4 +256,16 @@ void emul_test_put_fpu(
     /* TBD */
 }
 
+static uint32_t pkru;
+
+static unsigned int rdpkru(void)
+{
+    return pkru;
+}
+
+static void wrpkru(unsigned int val)
+{
+    pkru = val;
+}
+
 #include "x86_emulate/x86_emulate.c"
diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c
index 4a33fe9613..c25d88d0d8 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -5815,6 +5815,39 @@ x86_emulate(
             }
             break;
 
+        case 0xee:
+            switch ( vex.pfx )
+            {
+            case vex_none: /* rdpkru */
+                if ( !ops->read_cr ||
+                     ops->read_cr(4, &cr4, ctxt) != X86EMUL_OKAY )
+                    cr4 = 0;
+                generate_exception_if(!(cr4 & X86_CR4_PKE), EXC_UD);
+                generate_exception_if(_regs.ecx, EXC_GP, 0);
+                _regs.r(ax) = rdpkru();
+                _regs.r(dx) = 0;
+                break;
+            default:
+                goto unimplemented_insn;
+            }
+            break;
+
+        case 0xef:
+            switch ( vex.pfx )
+            {
+            case vex_none: /* wrpkru */
+                if ( !ops->read_cr ||
+                     ops->read_cr(4, &cr4, ctxt) != X86EMUL_OKAY )
+                    cr4 = 0;
+                generate_exception_if(!(cr4 & X86_CR4_PKE), EXC_UD);
+                generate_exception_if(_regs.ecx | _regs.edx, EXC_GP, 0);
+                wrpkru(_regs.eax);
+                break;
+            default:
+                goto unimplemented_insn;
+            }
+            break;
+
         case 0xf8: /* swapgs */
             generate_exception_if(!mode_64bit(), EXC_UD);
             generate_exception_if(!mode_ring0(), EXC_GP, 0);
diff --git a/xen/include/asm-x86/processor.h b/xen/include/asm-x86/processor.h
index d8d0dc8034..83143d4df8 100644
--- a/xen/include/asm-x86/processor.h
+++ b/xen/include/asm-x86/processor.h
@@ -377,6 +377,12 @@ static inline unsigned int rdpkru(void)
     return pkru;
 }
 
+static inline void wrpkru(unsigned int pkru)
+{
+    asm volatile ( ".byte 0x0f, 0x01, 0xef"
+                   :: "a" (pkru), "d" (0), "c" (0) );
+}
+
 /* Macros for PKRU domain */
 #define PKRU_READ  (0)
 #define PKRU_WRITE (1)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue May 04 08:55:09 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 May 2021 08:55:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.122015.230127 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ldqpe-0007hY-PE; Tue, 04 May 2021 08:55:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 122015.230127; Tue, 04 May 2021 08:55:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ldqpe-0007hQ-MG; Tue, 04 May 2021 08:55:06 +0000
Received: by outflank-mailman (input) for mailman id 122015;
 Tue, 04 May 2021 08:55:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldqpd-0007hJ-Bp
 for xen-changelog@lists.xenproject.org; Tue, 04 May 2021 08:55:05 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldqpd-0006or-6o
 for xen-changelog@lists.xenproject.org; Tue, 04 May 2021 08:55:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldqpd-0007MK-5l
 for xen-changelog@lists.xenproject.org; Tue, 04 May 2021 08:55:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ZduWNVgNpiREQ/fUt6hgUfYcUZh+vW34XOk4vIayd2Q=; b=04okyS0yUyQfzw0zekMbZcC8P/
	vu00934U+umN26WgaI/8CsTD2ccREVppQRhii+r9797MgVWFHO6Xc/9XO0Zl9y02t4ZLzeBL6pJer
	PTzYmTCqyl15J1kmoHGOPqCCSuymzRgATbhiDQ5H6ASff7RvXnwqrtm5lA7jzN3qWU/g=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/shim: don't permit HVM and PV_SHIM_EXCLUSIVE at the same time
Message-Id: <E1ldqpd-0007MK-5l@xenbits.xenproject.org>
Date: Tue, 04 May 2021 08:55:05 +0000

commit 075926410e997cc564c6b6ac6ddf17bc5459b445
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue May 4 10:49:22 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue May 4 10:49:22 2021 +0200

    x86/shim: don't permit HVM and PV_SHIM_EXCLUSIVE at the same time
    
    This combination doesn't really make sense (and there likely are more);
    in particular even if the code built with both options set, HVM guests
    wouldn't work (and I think one wouldn't be able to create one in the
    first place). The alternative here would be some presumably intrusive
    #ifdef-ary to get this combination to actually build (but still not
    work) again.
    
    Fixes: 8b5b49ceb3d9 ("x86: don't include domctl and alike in shim-exclusive builds")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/Kconfig | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/Kconfig b/xen/arch/x86/Kconfig
index 271b098fb5..e55e029b79 100644
--- a/xen/arch/x86/Kconfig
+++ b/xen/arch/x86/Kconfig
@@ -22,7 +22,7 @@ config X86
 	select HAS_PDX
 	select HAS_SCHED_GRANULARITY
 	select HAS_UBSAN
-	select HAS_VPCI if !PV_SHIM_EXCLUSIVE && HVM
+	select HAS_VPCI if HVM
 	select NEEDS_LIBELF
 	select NUMA
 
@@ -90,11 +90,12 @@ config PV_LINEAR_PT
          If unsure, say Y.
 
 config HVM
-	def_bool !PV_SHIM_EXCLUSIVE
+	bool "HVM support"
+	depends on !PV_SHIM_EXCLUSIVE
+	default !PV_SHIM
 	select COMPAT
 	select IOREQ_SERVER
 	select MEM_ACCESS_ALWAYS_ON
-	prompt "HVM support"
 	---help---
 	  Interfaces to support HVM domains.  HVM domains require hardware
 	  virtualisation extensions (e.g. Intel VT-x, AMD SVM), but can boot
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue May 04 08:55:16 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 May 2021 08:55:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.122016.230131 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ldqpo-0007io-RB; Tue, 04 May 2021 08:55:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 122016.230131; Tue, 04 May 2021 08:55:16 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ldqpo-0007ih-Nn; Tue, 04 May 2021 08:55:16 +0000
Received: by outflank-mailman (input) for mailman id 122016;
 Tue, 04 May 2021 08:55:15 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldqpn-0007iX-Eh
 for xen-changelog@lists.xenproject.org; Tue, 04 May 2021 08:55:15 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldqpn-0006ox-CC
 for xen-changelog@lists.xenproject.org; Tue, 04 May 2021 08:55:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldqpn-0007Mw-9H
 for xen-changelog@lists.xenproject.org; Tue, 04 May 2021 08:55:15 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=cgKyBmtOK1JykgTJvOPzaMHub52gI92tTArPT+AuLZk=; b=qomGM7xJYKgz7jKTFKVzxCMyBh
	JEiY46gp0FEm+GJkSDR4w7VMzaIcvSjABB0av44qm5u5Av6yRPdCSq3avvZGhApgUTp5W470N5yhE
	yO8anD8Th/wVIYBPlIs/7Tw7ocbZ5v8xJCDpcpn5aCvkeQ67CmNfvUbBxQfVG9NDyVz4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/time: avoid reading the platform timer in rendezvous functions
Message-Id: <E1ldqpn-0007Mw-9H@xenbits.xenproject.org>
Date: Tue, 04 May 2021 08:55:15 +0000

commit 48bb237fca65e2bcec7dbe7f4b178cf33c5e15f0
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue May 4 10:49:59 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue May 4 10:49:59 2021 +0200

    x86/time: avoid reading the platform timer in rendezvous functions
    
    Reading the platform timer isn't cheap, so we'd better avoid it when the
    resulting value is of no interest to anyone.
    
    The consumer of master_stime, obtained by
    time_calibration_{std,tsc}_rendezvous() and propagated through
    this_cpu(cpu_calibration), is local_time_calibration(). With
    CONSTANT_TSC the latter function uses an early exit path, which doesn't
    explicitly use the field. While this_cpu(cpu_calibration) (including the
    master_stime field) gets propagated to this_cpu(cpu_time).stamp on that
    path, both structures' fields get consumed only by the !CONSTANT_TSC
    logic of the function.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/time.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c
index 5578b7b3a2..10418cdc54 100644
--- a/xen/arch/x86/time.c
+++ b/xen/arch/x86/time.c
@@ -52,6 +52,7 @@ unsigned long pit0_ticks;
 struct cpu_time_stamp {
     u64 local_tsc;
     s_time_t local_stime;
+    /* Next field unconditionally valid only when !CONSTANT_TSC. */
     s_time_t master_stime;
 };
 
@@ -1702,7 +1703,7 @@ static void time_calibration_tsc_rendezvous(void *_r)
                  * iteration.
                  */
                 r->master_tsc_stamp = r->max_tsc_stamp;
-            else if ( i == 0 )
+            else if ( !boot_cpu_has(X86_FEATURE_CONSTANT_TSC) && i == 0 )
                 r->master_stime = read_platform_stime(NULL);
 
             atomic_inc(&r->semaphore);
@@ -1776,8 +1777,11 @@ static void time_calibration_std_rendezvous(void *_r)
     {
         while ( atomic_read(&r->semaphore) != (total_cpus - 1) )
             cpu_relax();
-        r->master_stime = read_platform_stime(NULL);
-        smp_wmb(); /* write r->master_stime /then/ signal */
+        if ( !boot_cpu_has(X86_FEATURE_CONSTANT_TSC) )
+        {
+            r->master_stime = read_platform_stime(NULL);
+            smp_wmb(); /* write r->master_stime /then/ signal */
+        }
         atomic_inc(&r->semaphore);
     }
     else
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue May 04 08:55:26 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 May 2021 08:55:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.122017.230135 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ldqpy-0007kB-Sc; Tue, 04 May 2021 08:55:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 122017.230135; Tue, 04 May 2021 08:55:26 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ldqpy-0007k3-Pa; Tue, 04 May 2021 08:55:26 +0000
Received: by outflank-mailman (input) for mailman id 122017;
 Tue, 04 May 2021 08:55:25 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldqpx-0007jr-Gl
 for xen-changelog@lists.xenproject.org; Tue, 04 May 2021 08:55:25 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldqpx-0006p7-G3
 for xen-changelog@lists.xenproject.org; Tue, 04 May 2021 08:55:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldqpx-0007NT-Ea
 for xen-changelog@lists.xenproject.org; Tue, 04 May 2021 08:55:25 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=cv8eOAd4Iko8jqCw3KlfktmxCcgSI10BLdieXRyKp4c=; b=oQ9otk2H7yFlZBMKG/3VpRKDOy
	glN2EZUg3Nc3z6wUeK0z77jhwxd3B1tvkQrDA5sLcRSk9MMOtSE9t5alHEMRRm3aK5mI+q7DLaNqQ
	mwhnbVM9Tmw44FXj7dR9mIDo19ySTYLDnezzNaGp6dhgHVTnmgIiw88Vdfbkix8Ym2QM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/xstate: re-use valid_xcr0() for boot-time checks
Message-Id: <E1ldqpx-0007NT-Ea@xenbits.xenproject.org>
Date: Tue, 04 May 2021 08:55:25 +0000

commit e927a3b89ae82ac875aafedbefd6b4bc46201b7d
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue May 4 10:50:32 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue May 4 10:50:32 2021 +0200

    x86/xstate: re-use valid_xcr0() for boot-time checks
    
    Instead of (just partially) open-coding it, re-use the function after
    suitably moving it up.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/xstate.c | 58 ++++++++++++++++++++++++++-------------------------
 1 file changed, 30 insertions(+), 28 deletions(-)

diff --git a/xen/arch/x86/xstate.c b/xen/arch/x86/xstate.c
index 3794d9a5a5..d49413b745 100644
--- a/xen/arch/x86/xstate.c
+++ b/xen/arch/x86/xstate.c
@@ -574,6 +574,34 @@ unsigned int xstate_ctxt_size(u64 xcr0)
     return _xstate_ctxt_size(xcr0);
 }
 
+static bool valid_xcr0(uint64_t xcr0)
+{
+    /* FP must be unconditionally set. */
+    if ( !(xcr0 & X86_XCR0_FP) )
+        return false;
+
+    /* YMM depends on SSE. */
+    if ( (xcr0 & X86_XCR0_YMM) && !(xcr0 & X86_XCR0_SSE) )
+        return false;
+
+    if ( xcr0 & (X86_XCR0_OPMASK | X86_XCR0_ZMM | X86_XCR0_HI_ZMM) )
+    {
+        /* OPMASK, ZMM, and HI_ZMM require YMM. */
+        if ( !(xcr0 & X86_XCR0_YMM) )
+            return false;
+
+        /* OPMASK, ZMM, and HI_ZMM must be the same. */
+        if ( ~xcr0 & (X86_XCR0_OPMASK | X86_XCR0_ZMM | X86_XCR0_HI_ZMM) )
+            return false;
+    }
+
+    /* BNDREGS and BNDCSR must be the same. */
+    if ( !(xcr0 & X86_XCR0_BNDREGS) != !(xcr0 & X86_XCR0_BNDCSR) )
+        return false;
+
+    return true;
+}
+
 /* Collect the information of processor's extended state */
 void xstate_init(struct cpuinfo_x86 *c)
 {
@@ -609,10 +637,9 @@ void xstate_init(struct cpuinfo_x86 *c)
     }
 
     cpuid_count(XSTATE_CPUID, 0, &eax, &ebx, &ecx, &edx);
-
-    BUG_ON((eax & XSTATE_FP_SSE) != XSTATE_FP_SSE);
-    BUG_ON((eax & X86_XCR0_YMM) && !(eax & X86_XCR0_SSE));
     feature_mask = (((u64)edx << 32) | eax) & XCNTXT_MASK;
+    BUG_ON(!valid_xcr0(feature_mask));
+    BUG_ON(!(feature_mask & X86_XCR0_SSE));
 
     /*
      * Set CR4_OSXSAVE and run "cpuid" to get xsave_cntxt_size.
@@ -642,31 +669,6 @@ void xstate_init(struct cpuinfo_x86 *c)
         BUG();
 }
 
-static bool valid_xcr0(u64 xcr0)
-{
-    /* FP must be unconditionally set. */
-    if ( !(xcr0 & X86_XCR0_FP) )
-        return false;
-
-    /* YMM depends on SSE. */
-    if ( (xcr0 & X86_XCR0_YMM) && !(xcr0 & X86_XCR0_SSE) )
-        return false;
-
-    if ( xcr0 & (X86_XCR0_OPMASK | X86_XCR0_ZMM | X86_XCR0_HI_ZMM) )
-    {
-        /* OPMASK, ZMM, and HI_ZMM require YMM. */
-        if ( !(xcr0 & X86_XCR0_YMM) )
-            return false;
-
-        /* OPMASK, ZMM, and HI_ZMM must be the same. */
-        if ( ~xcr0 & (X86_XCR0_OPMASK | X86_XCR0_ZMM | X86_XCR0_HI_ZMM) )
-            return false;
-    }
-
-    /* BNDREGS and BNDCSR must be the same. */
-    return !(xcr0 & X86_XCR0_BNDREGS) == !(xcr0 & X86_XCR0_BNDCSR);
-}
-
 int validate_xstate(const struct domain *d, uint64_t xcr0, uint64_t xcr0_accum,
                     const struct xsave_hdr *hdr)
 {
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue May 04 12:22:08 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 May 2021 12:22:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.122244.230534 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ldu3x-0003XI-6z; Tue, 04 May 2021 12:22:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 122244.230534; Tue, 04 May 2021 12:22:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ldu3x-0003XA-3n; Tue, 04 May 2021 12:22:05 +0000
Received: by outflank-mailman (input) for mailman id 122244;
 Tue, 04 May 2021 12:22:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldu3w-0003X5-EM
 for xen-changelog@lists.xenproject.org; Tue, 04 May 2021 12:22:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldu3w-000216-CH
 for xen-changelog@lists.xenproject.org; Tue, 04 May 2021 12:22:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldu3w-0000gh-BF
 for xen-changelog@lists.xenproject.org; Tue, 04 May 2021 12:22:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=GTCt/5W3og1dWIR/PHp1MlMiwiJw2lBBzR8gjGG3GzE=; b=bcJKMHGEp4r+W1A5t91bHQ4OTK
	7C+ye2sM//Y8PHojsWkpkIG/X7UaWA+wQCM3UV5jvzJm2kOAeMCBp9s3rFUoXm7YX76RWZZ4+paXV
	q3NDtw2Tg4c4YG8i03VnDvey/yFPvfrefwZS0TTOsTaBGTfZWIB7/DYjj6A44Vc47CJI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] SUPPORT.md: Document speculative attacks status of non-shim 32-bit PV
Message-Id: <E1ldu3w-0000gh-BF@xenbits.xenproject.org>
Date: Tue, 04 May 2021 12:22:04 +0000

commit ec4b43107f8663b4a3cf6b9605e1d80152a89f49
Author:     Ian Jackson <ian.jackson@eu.citrix.com>
AuthorDate: Tue Mar 9 15:00:47 2021 +0000
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue May 4 14:14:40 2021 +0200

    SUPPORT.md: Document speculative attacks status of non-shim 32-bit PV
    
    This documents, but does not fix, XSA-370.
    
    Reported-by: Jann Horn <jannh@google.com>
    Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
    Signed-off-by: George Dunlap <george.dunlap@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 SUPPORT.md | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/SUPPORT.md b/SUPPORT.md
index d0b8afe41c..d0d4fc6f4f 100644
--- a/SUPPORT.md
+++ b/SUPPORT.md
@@ -84,7 +84,16 @@ Traditional Xen PV guest
 
 No hardware requirements
 
-    Status: Supported
+    Status, x86_64: Supported
+    Status, x86_32, shim: Supported
+    Status, x86_32, without shim: Supported, with caveats
+
+Due to architectural limitations,
+32-bit PV guests must be assumed to be able to read arbitrary host memory
+using speculative execution attacks.
+Advisories will continue to be issued
+for new vulnerabilities related to un-shimmed 32-bit PV guests
+enabling denial-of-service attacks or privilege escalation attacks.
 
 ### x86/HVM
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue May 04 13:00:08 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 May 2021 13:00:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.122335.230705 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lduej-0008W1-Q2; Tue, 04 May 2021 13:00:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 122335.230705; Tue, 04 May 2021 13:00:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lduej-0008Vr-N0; Tue, 04 May 2021 13:00:05 +0000
Received: by outflank-mailman (input) for mailman id 122335;
 Tue, 04 May 2021 13:00:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lduei-0008N2-Kc
 for xen-changelog@lists.xenproject.org; Tue, 04 May 2021 13:00:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lduei-0002f7-I2
 for xen-changelog@lists.xenproject.org; Tue, 04 May 2021 13:00:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lduei-0004CB-Gw
 for xen-changelog@lists.xenproject.org; Tue, 04 May 2021 13:00:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=M9/ci4PtrY7S6waoIzEIm3XfpUgG+JyozhVETr98T/A=; b=1rem1esXCFejHmfqayaBJrGLNR
	HPdZ4eojifDsv0ahztiB3mz08NoKefi605qHKlQV9lH/ccKizjKwxAJQ0v2h5gxTYn1XRE6F1nXWH
	V11y9auZ2yqBEQvWQmdCMenuqEiTtg4GT1sVZVprBcCdLr96EgsOMeFzTKXov01bOKww=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.15] SUPPORT.md: Document speculative attacks status of non-shim 32-bit PV
Message-Id: <E1lduei-0004CB-Gw@xenbits.xenproject.org>
Date: Tue, 04 May 2021 13:00:04 +0000

commit 280d472f4fca070a10377e318d90cabfc2540810
Author:     Ian Jackson <ian.jackson@eu.citrix.com>
AuthorDate: Tue Mar 9 15:00:47 2021 +0000
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue May 4 14:58:03 2021 +0200

    SUPPORT.md: Document speculative attacks status of non-shim 32-bit PV
    
    This documents, but does not fix, XSA-370.
    
    Reported-by: Jann Horn <jannh@google.com>
    Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
    Signed-off-by: George Dunlap <george.dunlap@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 SUPPORT.md | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/SUPPORT.md b/SUPPORT.md
index d89af5abc8..9024d8a056 100644
--- a/SUPPORT.md
+++ b/SUPPORT.md
@@ -84,7 +84,16 @@ Traditional Xen PV guest
 
 No hardware requirements
 
-    Status: Supported
+    Status, x86_64: Supported
+    Status, x86_32, shim: Supported
+    Status, x86_32, without shim: Supported, with caveats
+
+Due to architectural limitations,
+32-bit PV guests must be assumed to be able to read arbitrary host memory
+using speculative execution attacks.
+Advisories will continue to be issued
+for new vulnerabilities related to un-shimmed 32-bit PV guests
+enabling denial-of-service attacks or privilege escalation attacks.
 
 ### x86/HVM
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.15


From xen-changelog-bounces@lists.xenproject.org Tue May 04 13:00:16 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 May 2021 13:00:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.122336.230710 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ldueu-00005G-RZ; Tue, 04 May 2021 13:00:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 122336.230710; Tue, 04 May 2021 13:00:16 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ldueu-000057-Oe; Tue, 04 May 2021 13:00:16 +0000
Received: by outflank-mailman (input) for mailman id 122336;
 Tue, 04 May 2021 13:00:15 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lduet-000050-40
 for xen-changelog@lists.xenproject.org; Tue, 04 May 2021 13:00:15 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lduet-0002fD-39
 for xen-changelog@lists.xenproject.org; Tue, 04 May 2021 13:00:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lduet-0004EB-27
 for xen-changelog@lists.xenproject.org; Tue, 04 May 2021 13:00:15 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=hOXHLAqpBnH+gbCRRj1qsslf4y8M5ZA0XiTCrP0oXDA=; b=mHQIrK9MZ9+RNCpiqs8eXdudsr
	GEItaREq+THlC7fjQMboRbE4nRayHiZCJqiFto+S6Hpt7pNIjSHwngmlnhSZjKzrg4NaTFOoWw5l0
	rdUfObXVHkfQ/bc2OG8UNKegBPBARumXzcHmDPOEFh90OcB1I1RnU1qqZqheD3vLoBvM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.14] SUPPORT.md: Document speculative attacks status of non-shim 32-bit PV
Message-Id: <E1lduet-0004EB-27@xenbits.xenproject.org>
Date: Tue, 04 May 2021 13:00:15 +0000

commit 10f0b2d49376865d49680f06c52b451fabce3bb5
Author:     Ian Jackson <ian.jackson@eu.citrix.com>
AuthorDate: Tue Mar 9 15:00:47 2021 +0000
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue May 4 14:58:33 2021 +0200

    SUPPORT.md: Document speculative attacks status of non-shim 32-bit PV
    
    This documents, but does not fix, XSA-370.
    
    Reported-by: Jann Horn <jannh@google.com>
    Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
    Signed-off-by: George Dunlap <george.dunlap@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 SUPPORT.md | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/SUPPORT.md b/SUPPORT.md
index 12e77ab66b..cd786ac0c1 100644
--- a/SUPPORT.md
+++ b/SUPPORT.md
@@ -80,7 +80,16 @@ Traditional Xen PV guest
 
 No hardware requirements
 
-    Status: Supported
+    Status, x86_64: Supported
+    Status, x86_32, shim: Supported
+    Status, x86_32, without shim: Supported, with caveats
+
+Due to architectural limitations,
+32-bit PV guests must be assumed to be able to read arbitrary host memory
+using speculative execution attacks.
+Advisories will continue to be issued
+for new vulnerabilities related to un-shimmed 32-bit PV guests
+enabling denial-of-service attacks or privilege escalation attacks.
 
 ### x86/HVM
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.14


From xen-changelog-bounces@lists.xenproject.org Tue May 04 13:00:26 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 May 2021 13:00:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.122337.230714 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lduf4-00006X-T3; Tue, 04 May 2021 13:00:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 122337.230714; Tue, 04 May 2021 13:00:26 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lduf4-00006P-Q8; Tue, 04 May 2021 13:00:26 +0000
Received: by outflank-mailman (input) for mailman id 122337;
 Tue, 04 May 2021 13:00:25 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lduf3-00006G-O6
 for xen-changelog@lists.xenproject.org; Tue, 04 May 2021 13:00:25 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lduf3-0002fK-M8
 for xen-changelog@lists.xenproject.org; Tue, 04 May 2021 13:00:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lduf3-0004FS-Jn
 for xen-changelog@lists.xenproject.org; Tue, 04 May 2021 13:00:25 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=S/zqzconKcjtzn/CTZAWFAajEdo74hKLfpuTpcH9ayg=; b=tAbzHEdhtpvqi59448kSHaAhOH
	FWdSvEGNgo1/OuBnk0iJHwB772t1CYTB8PaFdUvROXV72B8Kw7Ud7NgPhJ2S0DbIDXBOkRZPqszTj
	oV7WfbZ1uMqQhh2P58xEZfIqRbHksuzMjjZjwvAkLBhbcjdZ0boo4mKSz4ii9TPZ3urg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.13] SUPPORT.md: Document speculative attacks status of non-shim 32-bit PV
Message-Id: <E1lduf3-0004FS-Jn@xenbits.xenproject.org>
Date: Tue, 04 May 2021 13:00:25 +0000

commit 284132938900ce8c3b11babf7255f5c6dbb21716
Author:     Ian Jackson <ian.jackson@eu.citrix.com>
AuthorDate: Tue Mar 9 15:00:47 2021 +0000
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue May 4 14:59:12 2021 +0200

    SUPPORT.md: Document speculative attacks status of non-shim 32-bit PV
    
    This documents, but does not fix, XSA-370.
    
    Reported-by: Jann Horn <jannh@google.com>
    Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
    Signed-off-by: George Dunlap <george.dunlap@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 SUPPORT.md | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/SUPPORT.md b/SUPPORT.md
index 3b7a1a0a1a..b8fc04e934 100644
--- a/SUPPORT.md
+++ b/SUPPORT.md
@@ -80,7 +80,16 @@ Traditional Xen PV guest
 
 No hardware requirements
 
-    Status: Supported
+    Status, x86_64: Supported
+    Status, x86_32, shim: Supported
+    Status, x86_32, without shim: Supported, with caveats
+
+Due to architectural limitations,
+32-bit PV guests must be assumed to be able to read arbitrary host memory
+using speculative execution attacks.
+Advisories will continue to be issued
+for new vulnerabilities related to un-shimmed 32-bit PV guests
+enabling denial-of-service attacks or privilege escalation attacks.
 
 ### x86/HVM
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.13


From xen-changelog-bounces@lists.xenproject.org Tue May 04 13:00:37 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 May 2021 13:00:37 +0000
Received: from list by lists.xenproject.org with outflank-mailman.122338.230718 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ldufF-00008I-V2; Tue, 04 May 2021 13:00:37 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 122338.230718; Tue, 04 May 2021 13:00:37 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ldufF-000089-Rh; Tue, 04 May 2021 13:00:37 +0000
Received: by outflank-mailman (input) for mailman id 122338;
 Tue, 04 May 2021 13:00:36 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldufE-00007x-9P
 for xen-changelog@lists.xenproject.org; Tue, 04 May 2021 13:00:36 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldufE-0002fn-7i
 for xen-changelog@lists.xenproject.org; Tue, 04 May 2021 13:00:36 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldufE-0004HE-62
 for xen-changelog@lists.xenproject.org; Tue, 04 May 2021 13:00:36 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=dUQ1JMXYOWJkAQjtWxrzLyWQccFunzffXWjD1JVpHWs=; b=h9d59GLVGn+yBO8LN+cg9CP1UH
	X0/6OL9iwmVxxLD82+XE8POyf31zPyIHKN4ZNhqp8zGIte3FKR4Uvc6ww5w4S4tCSRY1yh8QQjeEf
	Y0sMLndyVqMcXyz/BetqG8tJWhzhjPgH+NfmtNEXfrTGyyipXq1Ppu//Z9UUMPqywDzM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.12] SUPPORT.md: Document speculative attacks status of non-shim 32-bit PV
Message-Id: <E1ldufE-0004HE-62@xenbits.xenproject.org>
Date: Tue, 04 May 2021 13:00:36 +0000

commit 5984905b2638df87a0262d1ee91f0a6e14a86df6
Author:     Ian Jackson <ian.jackson@eu.citrix.com>
AuthorDate: Tue Mar 9 15:00:47 2021 +0000
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue May 4 14:59:44 2021 +0200

    SUPPORT.md: Document speculative attacks status of non-shim 32-bit PV
    
    This documents, but does not fix, XSA-370.
    
    Reported-by: Jann Horn <jannh@google.com>
    Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
    Signed-off-by: George Dunlap <george.dunlap@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 SUPPORT.md | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/SUPPORT.md b/SUPPORT.md
index 79ebd51fb8..19f85cadf6 100644
--- a/SUPPORT.md
+++ b/SUPPORT.md
@@ -79,7 +79,16 @@ Traditional Xen PV guest
 
 No hardware requirements
 
-    Status: Supported
+    Status, x86_64: Supported
+    Status, x86_32, shim: Supported
+    Status, x86_32, without shim: Supported, with caveats
+
+Due to architectural limitations,
+32-bit PV guests must be assumed to be able to read arbitrary host memory
+using speculative execution attacks.
+Advisories will continue to be issued
+for new vulnerabilities related to un-shimmed 32-bit PV guests
+enabling denial-of-service attacks or privilege escalation attacks.
 
 ### x86/HVM
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.12


From xen-changelog-bounces@lists.xenproject.org Tue May 04 13:00:48 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 May 2021 13:00:48 +0000
Received: from list by lists.xenproject.org with outflank-mailman.122339.230722 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ldufQ-00009z-07; Tue, 04 May 2021 13:00:48 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 122339.230722; Tue, 04 May 2021 13:00:47 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ldufP-00009i-TH; Tue, 04 May 2021 13:00:47 +0000
Received: by outflank-mailman (input) for mailman id 122339;
 Tue, 04 May 2021 13:00:46 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldufO-00009b-QP
 for xen-changelog@lists.xenproject.org; Tue, 04 May 2021 13:00:46 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldufO-0002g0-Pf
 for xen-changelog@lists.xenproject.org; Tue, 04 May 2021 13:00:46 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldufO-0004Io-OL
 for xen-changelog@lists.xenproject.org; Tue, 04 May 2021 13:00:46 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=KGEEP8Ex7O5OOlJ4lRYVWQ2lIceRoxtvaygpOqS8bhY=; b=eRh3FPTAsylUDiHOHjVpN9DK8A
	6hSm/mhqfs2FJMwNsBWQR6yQRzNqvOpppsXisOYuyFwNRCqyRMArb+MjZIejmr1KFzyRNna3Wk4+t
	5jS2WulTRISzTV8EXbHXg/yR7Irw12fYuOIEUUGCku/rZ4sQpkSsbtWkTr6na2HyfnsM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.11] SUPPORT.md: Document speculative attacks status of non-shim 32-bit PV
Message-Id: <E1ldufO-0004Io-OL@xenbits.xenproject.org>
Date: Tue, 04 May 2021 13:00:46 +0000

commit b1e46bc369bb490b721c77f15d2583bbf466152d
Author:     Ian Jackson <ian.jackson@eu.citrix.com>
AuthorDate: Tue Mar 9 15:00:47 2021 +0000
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue May 4 15:00:24 2021 +0200

    SUPPORT.md: Document speculative attacks status of non-shim 32-bit PV
    
    This documents, but does not fix, XSA-370.
    
    Reported-by: Jann Horn <jannh@google.com>
    Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
    Signed-off-by: George Dunlap <george.dunlap@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 SUPPORT.md | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/SUPPORT.md b/SUPPORT.md
index 8a28a4c0e9..8e75b5afe9 100644
--- a/SUPPORT.md
+++ b/SUPPORT.md
@@ -73,7 +73,16 @@ Traditional Xen PV guest
 
 No hardware requirements
 
-    Status: Supported
+    Status, x86_64: Supported
+    Status, x86_32, shim: Supported
+    Status, x86_32, without shim: Supported, with caveats
+
+Due to architectural limitations,
+32-bit PV guests must be assumed to be able to read arbitrary host memory
+using speculative execution attacks.
+Advisories will continue to be issued
+for new vulnerabilities related to un-shimmed 32-bit PV guests
+enabling denial-of-service attacks or privilege escalation attacks.
 
 ### x86/HVM
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.11


From xen-changelog-bounces@lists.xenproject.org Tue May 04 18:22:17 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 May 2021 18:22:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.122679.231416 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ldzgQ-0001AM-Bg; Tue, 04 May 2021 18:22:10 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 122679.231416; Tue, 04 May 2021 18:22:10 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ldzgQ-0001AE-8f; Tue, 04 May 2021 18:22:10 +0000
Received: by outflank-mailman (input) for mailman id 122679;
 Tue, 04 May 2021 18:22:08 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldzgO-0001A8-QA
 for xen-changelog@lists.xenproject.org; Tue, 04 May 2021 18:22:08 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldzgO-0000Lj-Nk
 for xen-changelog@lists.xenproject.org; Tue, 04 May 2021 18:22:08 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldzgO-0001RG-M9
 for xen-changelog@lists.xenproject.org; Tue, 04 May 2021 18:22:08 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=NPzq+yTPwMdNl3reXtoGoc3PmY0N4Ilsdlu6i/tl7d0=; b=HPjWAnbK0/Ds7qwMvd3EO/Wxwy
	nOaR2nnkiTisXI2E4FvQC0bLB30hEqr6zMYXPTHQdYfc0N2Dy3GhSJbSpP6QtLA7veQR78Jlq92hz
	qn722zPG/JcH6jQ+X+aPTuW1rgDG+lWbGY1Dibdh2TAJdICr/lTzjkgRysEVxRBmF7jk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] libxl: don't ignore the return value from xc_cpuid_apply_policy
Message-Id: <E1ldzgO-0001RG-M9@xenbits.xenproject.org>
Date: Tue, 04 May 2021 18:22:08 +0000

commit 34990446ca91d9e201ff17bd4e3f43bfe3ad308e
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Thu Mar 18 11:11:22 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue May 4 18:35:35 2021 +0100

    libxl: don't ignore the return value from xc_cpuid_apply_policy
    
    Also change libxl__cpuid_legacy to propagate the error from
    xc_cpuid_apply_policy into callers.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
---
 tools/libs/light/libxl_cpuid.c    | 15 +++++++++++----
 tools/libs/light/libxl_create.c   |  5 +++--
 tools/libs/light/libxl_dom.c      |  2 +-
 tools/libs/light/libxl_internal.h |  4 ++--
 tools/libs/light/libxl_nocpuid.c  |  5 +++--
 5 files changed, 20 insertions(+), 11 deletions(-)

diff --git a/tools/libs/light/libxl_cpuid.c b/tools/libs/light/libxl_cpuid.c
index f32c5d3a6f..eb6feaa96d 100644
--- a/tools/libs/light/libxl_cpuid.c
+++ b/tools/libs/light/libxl_cpuid.c
@@ -426,11 +426,13 @@ int libxl_cpuid_parse_config_xend(libxl_cpuid_policy_list *cpuid,
     return 0;
 }
 
-void libxl__cpuid_legacy(libxl_ctx *ctx, uint32_t domid, bool restore,
-                         libxl_domain_build_info *info)
+int libxl__cpuid_legacy(libxl_ctx *ctx, uint32_t domid, bool restore,
+                        libxl_domain_build_info *info)
 {
+    GC_INIT(ctx);
     bool pae = true;
     bool itsc;
+    int r;
 
     /*
      * Gross hack.  Using libxl_defbool_val() here causes libvirt to crash in
@@ -469,8 +471,13 @@ void libxl__cpuid_legacy(libxl_ctx *ctx, uint32_t domid, bool restore,
     itsc = (libxl_defbool_val(info->disable_migrate) ||
             info->tsc_mode == LIBXL_TSC_MODE_ALWAYS_EMULATE);
 
-    xc_cpuid_apply_policy(ctx->xch, domid, restore, NULL, 0,
-                          pae, itsc, nested_virt, info->cpuid);
+    r = xc_cpuid_apply_policy(ctx->xch, domid, restore, NULL, 0,
+                              pae, itsc, nested_virt, info->cpuid);
+    if (r)
+        LOGEVD(ERROR, -r, domid, "Failed to apply CPUID policy");
+
+    GC_FREE;
+    return r ? ERROR_FAIL : 0;
 }
 
 static const char *input_names[2] = { "leaf", "subleaf" };
diff --git a/tools/libs/light/libxl_create.c b/tools/libs/light/libxl_create.c
index 43e9ba9c63..e356b2106d 100644
--- a/tools/libs/light/libxl_create.c
+++ b/tools/libs/light/libxl_create.c
@@ -1434,6 +1434,7 @@ int libxl__srm_callout_callback_static_data_done(unsigned int missing,
 
     libxl_domain_config *d_config = dcs->guest_config;
     libxl_domain_build_info *info = &d_config->b_info;
+    int rc = 0;
 
     /*
      * CPUID/MSR information is not present in pre Xen-4.14 streams.
@@ -1443,9 +1444,9 @@ int libxl__srm_callout_callback_static_data_done(unsigned int missing,
      * stream doesn't contain any CPUID data.
      */
     if (missing & XGR_SDD_MISSING_CPUID)
-        libxl__cpuid_legacy(ctx, dcs->guest_domid, true, info);
+        rc = libxl__cpuid_legacy(ctx, dcs->guest_domid, true, info);
 
-    return 0;
+    return rc;
 }
 
 void libxl__srm_callout_callback_restore_results(xen_pfn_t store_mfn,
diff --git a/tools/libs/light/libxl_dom.c b/tools/libs/light/libxl_dom.c
index 842a51c86c..e9f58ee4b2 100644
--- a/tools/libs/light/libxl_dom.c
+++ b/tools/libs/light/libxl_dom.c
@@ -384,7 +384,7 @@ int libxl__build_pre(libxl__gc *gc, uint32_t domid,
      * being migrated-in/restored have CPUID handled during the
      * static_data_done() callback. */
     if (!state->restore)
-        libxl__cpuid_legacy(ctx, domid, false, info);
+        rc = libxl__cpuid_legacy(ctx, domid, false, info);
 
     return rc;
 }
diff --git a/tools/libs/light/libxl_internal.h b/tools/libs/light/libxl_internal.h
index c6a4a187f5..44a2f3c8fe 100644
--- a/tools/libs/light/libxl_internal.h
+++ b/tools/libs/light/libxl_internal.h
@@ -2052,8 +2052,8 @@ typedef yajl_gen_status (*libxl__gen_json_callback)(yajl_gen hand, void *);
 _hidden char *libxl__object_to_json(libxl_ctx *ctx, const char *type,
                                     libxl__gen_json_callback gen, void *p);
 
-_hidden void libxl__cpuid_legacy(libxl_ctx *ctx, uint32_t domid, bool retore,
-                                 libxl_domain_build_info *info);
+_hidden int libxl__cpuid_legacy(libxl_ctx *ctx, uint32_t domid, bool retore,
+                                libxl_domain_build_info *info);
 
 /* Calls poll() again - useful to check whether a signaled condition
  * is still true.  Cannot fail.  Returns currently-true revents. */
diff --git a/tools/libs/light/libxl_nocpuid.c b/tools/libs/light/libxl_nocpuid.c
index f47336565b..0630959e76 100644
--- a/tools/libs/light/libxl_nocpuid.c
+++ b/tools/libs/light/libxl_nocpuid.c
@@ -34,9 +34,10 @@ int libxl_cpuid_parse_config_xend(libxl_cpuid_policy_list *cpuid,
     return 0;
 }
 
-void libxl__cpuid_legacy(libxl_ctx *ctx, uint32_t domid, bool restore,
-                         libxl_domain_build_info *info)
+int libxl__cpuid_legacy(libxl_ctx *ctx, uint32_t domid, bool restore,
+                        libxl_domain_build_info *info)
 {
+    return 0;
 }
 
 yajl_gen_status libxl_cpuid_policy_list_gen_json(yajl_gen hand,
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue May 04 18:22:20 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 May 2021 18:22:20 +0000
Received: from list by lists.xenproject.org with outflank-mailman.122680.231419 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ldzga-0001B3-DF; Tue, 04 May 2021 18:22:20 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 122680.231419; Tue, 04 May 2021 18:22:20 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ldzga-0001Aw-AA; Tue, 04 May 2021 18:22:20 +0000
Received: by outflank-mailman (input) for mailman id 122680;
 Tue, 04 May 2021 18:22:18 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldzgY-0001Aq-Tt
 for xen-changelog@lists.xenproject.org; Tue, 04 May 2021 18:22:18 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldzgY-0000Lm-T6
 for xen-changelog@lists.xenproject.org; Tue, 04 May 2021 18:22:18 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldzgY-0001SG-Qe
 for xen-changelog@lists.xenproject.org; Tue, 04 May 2021 18:22:18 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=PbDQ4qg/tOoC0mCu7pSSjn5P//L377m6KgPBzSjgnUk=; b=svrw0dDgGRuP3s1exbCvmHgMBQ
	K7Konottg3d0MKMJ0qABymyszoSbetQ9asDZhFBFXVN2N92uYwHiCphwxqeXwCgSJOEPYpsENRxvZ
	mRZP87aB0fIk52wopAp7L6vzqqj5IvTY4snwB10HED6uyfVNB48V+KmxB9j2f4MVssog=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] libs/guest: allow updating a cpu policy CPUID data
Message-Id: <E1ldzgY-0001SG-Qe@xenbits.xenproject.org>
Date: Tue, 04 May 2021 18:22:18 +0000

commit 2d09c97e58ea455242a3862c16e732592841ddde
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Wed Mar 17 16:49:55 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue May 4 18:35:53 2021 +0100

    libs/guest: allow updating a cpu policy CPUID data
    
    Introduce a helper to update the CPUID policy using an array of
    xen_cpuid_leaf_t entries. Note the leaves present in the input
    xen_cpuid_leaf_t array will replace any existing leaves on the policy.
    
    No user of the interface introduced on this patch.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/include/xenctrl.h         |  3 +++
 tools/libs/guest/xg_cpuid_x86.c | 20 ++++++++++++++++++++
 2 files changed, 23 insertions(+)

diff --git a/tools/include/xenctrl.h b/tools/include/xenctrl.h
index 27cec1b93f..543bd2a4c2 100644
--- a/tools/include/xenctrl.h
+++ b/tools/include/xenctrl.h
@@ -2608,6 +2608,9 @@ int xc_cpu_policy_set_domain(xc_interface *xch, uint32_t domid,
 int xc_cpu_policy_serialise(xc_interface *xch, const xc_cpu_policy_t policy,
                             xen_cpuid_leaf_t *leaves, uint32_t *nr_leaves,
                             xen_msr_entry_t *msrs, uint32_t *nr_msrs);
+int xc_cpu_policy_update_cpuid(xc_interface *xch, xc_cpu_policy_t policy,
+                               const xen_cpuid_leaf_t *leaves,
+                               uint32_t nr);
 
 int xc_get_cpu_levelling_caps(xc_interface *xch, uint32_t *caps);
 int xc_get_cpu_featureset(xc_interface *xch, uint32_t index,
diff --git a/tools/libs/guest/xg_cpuid_x86.c b/tools/libs/guest/xg_cpuid_x86.c
index 0c9b3a960f..713649edde 100644
--- a/tools/libs/guest/xg_cpuid_x86.c
+++ b/tools/libs/guest/xg_cpuid_x86.c
@@ -822,3 +822,23 @@ int xc_cpu_policy_serialise(xc_interface *xch, const xc_cpu_policy_t p,
     errno = 0;
     return 0;
 }
+
+int xc_cpu_policy_update_cpuid(xc_interface *xch, xc_cpu_policy_t policy,
+                               const xen_cpuid_leaf_t *leaves,
+                               uint32_t nr)
+{
+    unsigned int err_leaf = -1, err_subleaf = -1;
+    int rc = x86_cpuid_copy_from_buffer(&policy->cpuid, leaves, nr,
+                                        &err_leaf, &err_subleaf);
+
+    if ( rc )
+    {
+        if ( err_leaf != -1 )
+            ERROR("Failed to update CPUID (err leaf %#x, subleaf %#x) (%d = %s)",
+                  err_leaf, err_subleaf, -rc, strerror(-rc));
+        errno = -rc;
+        rc = -1;
+    }
+
+    return rc;
+}
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue May 04 18:22:29 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 May 2021 18:22:29 +0000
Received: from list by lists.xenproject.org with outflank-mailman.122681.231424 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ldzgj-0001CQ-H6; Tue, 04 May 2021 18:22:29 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 122681.231424; Tue, 04 May 2021 18:22:29 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ldzgj-0001CH-Ds; Tue, 04 May 2021 18:22:29 +0000
Received: by outflank-mailman (input) for mailman id 122681;
 Tue, 04 May 2021 18:22:29 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldzgj-0001CC-2M
 for xen-changelog@lists.xenproject.org; Tue, 04 May 2021 18:22:29 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldzgj-0000Lx-1W
 for xen-changelog@lists.xenproject.org; Tue, 04 May 2021 18:22:29 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldzgi-0001T2-VS
 for xen-changelog@lists.xenproject.org; Tue, 04 May 2021 18:22:28 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=nk5J6u7vZ3oMqVL9Z/HeHUwhAq1MbcCtXmbK8PpLAhE=; b=FhnSvelttwxyMxQA2qvak38WM+
	4o7HOuWmBheRjYPVlYHSqGq/pKJvUNC09N2zYP4KjCE9YrR4THg0O765zvVDNAEA93e8K8Ol0jc9n
	bsv5z6KyDwoXYJQIoVParYB8SEevJV+EiWSl+muOLFT3MFg0SXHvmTVGxFUZsQsvigGc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] libs/guest: allow updating a cpu policy MSR data
Message-Id: <E1ldzgi-0001T2-VS@xenbits.xenproject.org>
Date: Tue, 04 May 2021 18:22:28 +0000

commit 989cf2db33f0c65d118667410be6c6ce604741d7
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Wed Mar 17 16:59:37 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue May 4 18:36:17 2021 +0100

    libs/guest: allow updating a cpu policy MSR data
    
    Introduce a helper to update the MSR policy using an array of
    xen_msr_entry_t entries. Note the MSRs present in the input
    xen_msr_entry_t array will replace any existing entries on the
    policy.
    
    No user of the interface introduced on this patch.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/include/xenctrl.h         |  2 ++
 tools/libs/guest/xg_cpuid_x86.c | 18 ++++++++++++++++++
 2 files changed, 20 insertions(+)

diff --git a/tools/include/xenctrl.h b/tools/include/xenctrl.h
index 543bd2a4c2..0a9e5fbd21 100644
--- a/tools/include/xenctrl.h
+++ b/tools/include/xenctrl.h
@@ -2611,6 +2611,8 @@ int xc_cpu_policy_serialise(xc_interface *xch, const xc_cpu_policy_t policy,
 int xc_cpu_policy_update_cpuid(xc_interface *xch, xc_cpu_policy_t policy,
                                const xen_cpuid_leaf_t *leaves,
                                uint32_t nr);
+int xc_cpu_policy_update_msrs(xc_interface *xch, xc_cpu_policy_t policy,
+                              const xen_msr_entry_t *msrs, uint32_t nr);
 
 int xc_get_cpu_levelling_caps(xc_interface *xch, uint32_t *caps);
 int xc_get_cpu_featureset(xc_interface *xch, uint32_t index,
diff --git a/tools/libs/guest/xg_cpuid_x86.c b/tools/libs/guest/xg_cpuid_x86.c
index 713649edde..f14c5fead2 100644
--- a/tools/libs/guest/xg_cpuid_x86.c
+++ b/tools/libs/guest/xg_cpuid_x86.c
@@ -842,3 +842,21 @@ int xc_cpu_policy_update_cpuid(xc_interface *xch, xc_cpu_policy_t policy,
 
     return rc;
 }
+
+int xc_cpu_policy_update_msrs(xc_interface *xch, xc_cpu_policy_t policy,
+                              const xen_msr_entry_t *msrs, uint32_t nr)
+{
+    unsigned int err_msr = -1;
+    int rc = x86_msr_copy_from_buffer(&policy->msr, msrs, nr, &err_msr);
+
+    if ( rc )
+    {
+        if ( err_msr != -1 )
+            ERROR("Failed to deserialise MSRS (err index %#x) (%d = %s)",
+                  err_msr, -rc, strerror(-rc));
+        errno = -rc;
+        rc = -1;
+    }
+
+    return rc;
+}
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue May 04 18:22:39 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 May 2021 18:22:39 +0000
Received: from list by lists.xenproject.org with outflank-mailman.122682.231429 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ldzgt-0001E4-Ix; Tue, 04 May 2021 18:22:39 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 122682.231429; Tue, 04 May 2021 18:22:39 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ldzgt-0001Dt-FS; Tue, 04 May 2021 18:22:39 +0000
Received: by outflank-mailman (input) for mailman id 122682;
 Tue, 04 May 2021 18:22:39 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldzgt-0001Dm-5S
 for xen-changelog@lists.xenproject.org; Tue, 04 May 2021 18:22:39 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldzgt-0000M6-4i
 for xen-changelog@lists.xenproject.org; Tue, 04 May 2021 18:22:39 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldzgt-0001Ti-3r
 for xen-changelog@lists.xenproject.org; Tue, 04 May 2021 18:22:39 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=NAFlb3P5mKNQGTLgkSnXpyTE9dmLcMrlVmIPa5xGcO4=; b=wTqIKv2CeYQcFzlKGLd0jv6qMl
	yd7OLrsMQNMQYhrA/eql4z2BI79Z5yLSj7sXlofEgJlX6aLENzTA0gMm8i5Ad1a0h2HHVfgCsSt+E
	XbB9CJxakTdwqsniHBmqkgef96cHF4xSdSU4UnT7Ro2rWKKud4o1upFog+SbO4i+ZV4A=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] libs/guest: introduce helper to check cpu policy compatibility
Message-Id: <E1ldzgt-0001Ti-3r@xenbits.xenproject.org>
Date: Tue, 04 May 2021 18:22:39 +0000

commit 398ff4725b7b4804a3b8f5ee376f3d95d4bd32cd
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Wed Mar 17 17:09:45 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue May 4 18:37:30 2021 +0100

    libs/guest: introduce helper to check cpu policy compatibility
    
    Such helpers is just a wrapper to the existing
    x86_cpu_policies_are_compatible function. This requires building
    policy.c from libx86 on user land also.
    
    No user of the interface introduced.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/include/xenctrl.h         |  4 ++++
 tools/libs/guest/Makefile       |  2 +-
 tools/libs/guest/xg_cpuid_x86.c | 19 +++++++++++++++++++
 3 files changed, 24 insertions(+), 1 deletion(-)

diff --git a/tools/include/xenctrl.h b/tools/include/xenctrl.h
index 0a9e5fbd21..0fdb2e8885 100644
--- a/tools/include/xenctrl.h
+++ b/tools/include/xenctrl.h
@@ -2614,6 +2614,10 @@ int xc_cpu_policy_update_cpuid(xc_interface *xch, xc_cpu_policy_t policy,
 int xc_cpu_policy_update_msrs(xc_interface *xch, xc_cpu_policy_t policy,
                               const xen_msr_entry_t *msrs, uint32_t nr);
 
+/* Compatibility calculations. */
+bool xc_cpu_policy_is_compatible(xc_interface *xch, const xc_cpu_policy_t host,
+                                 const xc_cpu_policy_t guest);
+
 int xc_get_cpu_levelling_caps(xc_interface *xch, uint32_t *caps);
 int xc_get_cpu_featureset(xc_interface *xch, uint32_t index,
                           uint32_t *nr_features, uint32_t *featureset);
diff --git a/tools/libs/guest/Makefile b/tools/libs/guest/Makefile
index 604e1695d6..6d2a1d5bbc 100644
--- a/tools/libs/guest/Makefile
+++ b/tools/libs/guest/Makefile
@@ -40,7 +40,7 @@ $(patsubst %.c,%.opic,$(ELF_SRCS-y)): CFLAGS += -Wno-pointer-sign
 ifeq ($(CONFIG_X86),y) # Add libx86 to the build
 vpath %.c ../../../xen/lib/x86
 
-SRCS-y                 += cpuid.c msr.c
+SRCS-y                 += cpuid.c msr.c policy.c
 endif
 
 # new domain builder
diff --git a/tools/libs/guest/xg_cpuid_x86.c b/tools/libs/guest/xg_cpuid_x86.c
index f14c5fead2..d4e02cecb1 100644
--- a/tools/libs/guest/xg_cpuid_x86.c
+++ b/tools/libs/guest/xg_cpuid_x86.c
@@ -860,3 +860,22 @@ int xc_cpu_policy_update_msrs(xc_interface *xch, xc_cpu_policy_t policy,
 
     return rc;
 }
+
+bool xc_cpu_policy_is_compatible(xc_interface *xch, const xc_cpu_policy_t host,
+                                 const xc_cpu_policy_t guest)
+{
+    struct cpu_policy_errors err = INIT_CPU_POLICY_ERRORS;
+    struct cpu_policy h = { &host->cpuid, &host->msr };
+    struct cpu_policy g = { &guest->cpuid, &guest->msr };
+    int rc = x86_cpu_policies_are_compatible(&h, &g, &err);
+
+    if ( !rc )
+        return true;
+
+    if ( err.leaf != -1 )
+        ERROR("Leaf %#x subleaf %#x is not compatible", err.leaf, err.subleaf);
+    if ( err.msr != -1 )
+        ERROR("MSR index %#x is not compatible", err.msr);
+
+    return false;
+}
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue May 04 18:22:50 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 May 2021 18:22:50 +0000
Received: from list by lists.xenproject.org with outflank-mailman.122683.231432 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ldzh4-0001Fs-KK; Tue, 04 May 2021 18:22:50 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 122683.231432; Tue, 04 May 2021 18:22:50 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ldzh4-0001Fg-H4; Tue, 04 May 2021 18:22:50 +0000
Received: by outflank-mailman (input) for mailman id 122683;
 Tue, 04 May 2021 18:22:49 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldzh3-0001FY-8l
 for xen-changelog@lists.xenproject.org; Tue, 04 May 2021 18:22:49 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldzh3-0000MZ-82
 for xen-changelog@lists.xenproject.org; Tue, 04 May 2021 18:22:49 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldzh3-0001Um-71
 for xen-changelog@lists.xenproject.org; Tue, 04 May 2021 18:22:49 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=I5nomYiU26NgLEBZT5KxEwjtvECzMS3BtBEyO7/Szk8=; b=iXRYUdMrufMYNfq9o6lc22Nk2Z
	QqOf2j/uitGGP2LyssJzL+zu605RABBy6qsZRfFe6wniEbYMd5F/w/tGnPpugreJCfvflFm5d4VTX
	RCk3g4Jdu2dt5fgQRhX+f5WpO9JAKeyIw/EhPczr2hsul0V4/9ozlEwx7mm/0eK7P98o=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xl: constify cmd_table entries
Message-Id: <E1ldzh3-0001Um-71@xenbits.xenproject.org>
Date: Tue, 04 May 2021 18:22:49 +0000

commit aaf61c4750d467176cd49323019cd286e35b8688
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Tue May 4 17:14:36 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue May 4 19:09:55 2021 +0100

    xl: constify cmd_table entries
    
    Also constify cmdtable_len and make use of ARRAY_SIZE, which is
    available in "xen-tools/libs.h".
    
    The entries in cmd_table don't need to be modified once xl is running.
    
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
---
 tools/xl/xl.c          | 4 ++--
 tools/xl/xl.h          | 6 +++---
 tools/xl/xl_cmdtable.c | 9 +++++----
 3 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/tools/xl/xl.c b/tools/xl/xl.c
index 3a89295802..4107d10fd4 100644
--- a/tools/xl/xl.c
+++ b/tools/xl/xl.c
@@ -362,7 +362,7 @@ int main(int argc, char **argv)
 {
     int opt = 0;
     char *cmd = 0;
-    struct cmd_spec *cspec;
+    const struct cmd_spec *cspec;
     int ret;
     void *config_data = 0;
     int config_len = 0;
@@ -462,7 +462,7 @@ int child_report(xlchildnum child)
 void help(const char *command)
 {
     int i;
-    struct cmd_spec *cmd;
+    const struct cmd_spec *cmd;
 
     if (!command || !strcmp(command, "help")) {
         printf("Usage xl [-vfNtT] <subcommand> [args]\n\n");
diff --git a/tools/xl/xl.h b/tools/xl/xl.h
index 137a29077c..e5a106dfbc 100644
--- a/tools/xl/xl.h
+++ b/tools/xl/xl.h
@@ -218,10 +218,10 @@ int main_qemu_monitor_command(int argc, char **argv);
 void help(const char *command);
 
 extern const char *common_domname;
-extern struct cmd_spec cmd_table[];
-extern int cmdtable_len;
+extern const struct cmd_spec cmd_table[];
+extern const int cmdtable_len;
 /* Look up a command in the table, allowing unambiguous truncation */
-struct cmd_spec *cmdtable_lookup(const char *s);
+const struct cmd_spec *cmdtable_lookup(const char *s);
 
 extern libxl_ctx *ctx;
 extern xentoollog_logger_stdiostream *logger;
diff --git a/tools/xl/xl_cmdtable.c b/tools/xl/xl_cmdtable.c
index 07f54daabe..661323d488 100644
--- a/tools/xl/xl_cmdtable.c
+++ b/tools/xl/xl_cmdtable.c
@@ -15,10 +15,11 @@
 #include <string.h>
 
 #include <libxl.h>
+#include <xen-tools/libs.h>
 
 #include "xl.h"
 
-struct cmd_spec cmd_table[] = {
+const struct cmd_spec cmd_table[] = {
     { "create",
       &main_create, 1, 1,
       "Create a domain from config file <filename>",
@@ -631,12 +632,12 @@ struct cmd_spec cmd_table[] = {
     },
 };
 
-int cmdtable_len = sizeof(cmd_table)/sizeof(struct cmd_spec);
+const int cmdtable_len = ARRAY_SIZE(cmd_table);
 
 /* Look up a command in the table, allowing unambiguous truncation */
-struct cmd_spec *cmdtable_lookup(const char *s)
+const struct cmd_spec *cmdtable_lookup(const char *s)
 {
-    struct cmd_spec *cmd = NULL;
+    const struct cmd_spec *cmd = NULL;
     size_t len;
     int i, count = 0;
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue May 04 18:23:00 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 May 2021 18:23:00 +0000
Received: from list by lists.xenproject.org with outflank-mailman.122684.231436 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ldzhE-0001H1-LY; Tue, 04 May 2021 18:23:00 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 122684.231436; Tue, 04 May 2021 18:23:00 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ldzhE-0001Gt-Ia; Tue, 04 May 2021 18:23:00 +0000
Received: by outflank-mailman (input) for mailman id 122684;
 Tue, 04 May 2021 18:22:59 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldzhD-0001Gm-HW
 for xen-changelog@lists.xenproject.org; Tue, 04 May 2021 18:22:59 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldzhD-0000Mh-Ge
 for xen-changelog@lists.xenproject.org; Tue, 04 May 2021 18:22:59 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldzhD-0001Vv-F7
 for xen-changelog@lists.xenproject.org; Tue, 04 May 2021 18:22:59 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=unNmRRczYynk8vGsCTBiElmpVbtooVgi9rrOFHvdLOc=; b=qX7r2Dk82bC7CNmBLOzrNilHQI
	V+LYQzdmLoCqNBj8K84BkuZENKFpwsvJKTop9Xta3gBltfaXVvrDnn03CIOjPTXSP9IR+U5yV0n/M
	aa+SFTiyUfW290qFBJNhvGvjgh9u/ANZYN+bcgpxf1rmPpcbHLGVQsQejw0YZIRQArDE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools: handle missing xencommons in xenconsoled.service
Message-Id: <E1ldzhD-0001Vv-F7@xenbits.xenproject.org>
Date: Tue, 04 May 2021 18:22:59 +0000

commit 74a8d446f7dc1f18174f48597d7ebb04a634a120
Author:     Olaf Hering <olaf@aepfle.de>
AuthorDate: Tue May 4 15:58:54 2021 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue May 4 19:10:42 2021 +0100

    tools: handle missing xencommons in xenconsoled.service
    
    sysconfig files are not mandatory.
    Adjust xenconsoled.service to handle a missing sysconfig file by
    prepending a dash to the to-be-sourced filename.
    
    Signed-off-by: Olaf Hering <olaf@aepfle.de>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/hotplug/Linux/systemd/xenconsoled.service.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/hotplug/Linux/systemd/xenconsoled.service.in b/tools/hotplug/Linux/systemd/xenconsoled.service.in
index 8e333b114e..1f03de9041 100644
--- a/tools/hotplug/Linux/systemd/xenconsoled.service.in
+++ b/tools/hotplug/Linux/systemd/xenconsoled.service.in
@@ -9,7 +9,7 @@ Type=simple
 Environment=XENCONSOLED_ARGS=
 Environment=XENCONSOLED_TRACE=none
 Environment=XENCONSOLED_LOG_DIR=@XEN_LOG_DIR@/console
-EnvironmentFile=@CONFIG_DIR@/@CONFIG_LEAF_DIR@/xencommons
+EnvironmentFile=-@CONFIG_DIR@/@CONFIG_LEAF_DIR@/xencommons
 ExecStartPre=/bin/grep -q control_d /proc/xen/capabilities
 ExecStartPre=/bin/mkdir -p ${XENCONSOLED_LOG_DIR}
 ExecStart=@sbindir@/xenconsoled -i --log=${XENCONSOLED_TRACE} --log-dir=${XENCONSOLED_LOG_DIR} $XENCONSOLED_ARGS
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue May 04 18:23:10 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 May 2021 18:23:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.122685.231439 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ldzhO-0001I8-NJ; Tue, 04 May 2021 18:23:10 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 122685.231439; Tue, 04 May 2021 18:23:10 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ldzhO-0001I1-KF; Tue, 04 May 2021 18:23:10 +0000
Received: by outflank-mailman (input) for mailman id 122685;
 Tue, 04 May 2021 18:23:09 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldzhN-0001Hr-LM
 for xen-changelog@lists.xenproject.org; Tue, 04 May 2021 18:23:09 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldzhN-0000N7-Jq
 for xen-changelog@lists.xenproject.org; Tue, 04 May 2021 18:23:09 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldzhN-0001Wt-It
 for xen-changelog@lists.xenproject.org; Tue, 04 May 2021 18:23:09 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=hUuW0ASF4OBu7bzN8TsQYQxfb1GPnalRufv4c6N80N0=; b=mggt3uxw277mAGfFtv/Mp2wuOP
	KkKk6gGYelE5gJLWloVGwJSI9XG4kl1a+XOF3TpIhf5awvZ+xu81ETW3MmqMGc1Jynp/b/4kyQ6TW
	cC+tjTeWXgDqGJ/g5SFyV7CL/LHOTLt+iXJJ5/bd94TNyhvblNzaToi+z9QVDo7FNCmc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools: handle missing xencommons in xen-init-dom0.service
Message-Id: <E1ldzhN-0001Wt-It@xenbits.xenproject.org>
Date: Tue, 04 May 2021 18:23:09 +0000

commit 27f32dbdb1b11d171f0fa4dfd3263b44e9f7c71c
Author:     Olaf Hering <olaf@aepfle.de>
AuthorDate: Tue May 4 16:31:28 2021 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue May 4 19:10:43 2021 +0100

    tools: handle missing xencommons in xen-init-dom0.service
    
    sysconfig files are not mandatory.
    Adjust xen-init-dom0.service to handle a missing sysconfig file by
    prepending a dash to the to-be-sourced filename.
    
    Signed-off-by: Olaf Hering <olaf@aepfle.de>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/hotplug/Linux/systemd/xen-init-dom0.service.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/hotplug/Linux/systemd/xen-init-dom0.service.in b/tools/hotplug/Linux/systemd/xen-init-dom0.service.in
index beed3126c6..98779b8507 100644
--- a/tools/hotplug/Linux/systemd/xen-init-dom0.service.in
+++ b/tools/hotplug/Linux/systemd/xen-init-dom0.service.in
@@ -7,7 +7,7 @@ ConditionPathExists=/proc/xen/capabilities
 [Service]
 Type=oneshot
 RemainAfterExit=true
-EnvironmentFile=@CONFIG_DIR@/@CONFIG_LEAF_DIR@/xencommons
+EnvironmentFile=-@CONFIG_DIR@/@CONFIG_LEAF_DIR@/xencommons
 ExecStartPre=/bin/grep -q control_d /proc/xen/capabilities
 ExecStart=@LIBEXEC_BIN@/xen-init-dom0 $XEN_DOM0_UUID
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue May 04 18:23:20 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 May 2021 18:23:20 +0000
Received: from list by lists.xenproject.org with outflank-mailman.122686.231444 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ldzhY-0001Jb-P3; Tue, 04 May 2021 18:23:20 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 122686.231444; Tue, 04 May 2021 18:23:20 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ldzhY-0001JS-M5; Tue, 04 May 2021 18:23:20 +0000
Received: by outflank-mailman (input) for mailman id 122686;
 Tue, 04 May 2021 18:23:19 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldzhX-0001JI-O7
 for xen-changelog@lists.xenproject.org; Tue, 04 May 2021 18:23:19 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldzhX-0000NG-NK
 for xen-changelog@lists.xenproject.org; Tue, 04 May 2021 18:23:19 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldzhX-0001Z4-MI
 for xen-changelog@lists.xenproject.org; Tue, 04 May 2021 18:23:19 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=dV266auclXnWRlff6qeucPAQ8E7Xac8oMdp20IOOBqI=; b=EgKt4yDhEodbW086nGGaUVQLc2
	UHbkS5T2Fisj90J1VTqYbzNNbcoiQDrY9bxLKfg5KQlFfYNC3P9YVBWjQ5sOwyZjNoh8E7ckDkdEH
	DdVJdVvtOkCFH78URFcfE1dVgMU4RR0m7pnHVVl3JaBKvMH+EHwrkioWBHdglrG16YV0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/xstate: Elide redundant writes in set_xcr0()
Message-Id: <E1ldzhX-0001Z4-MI@xenbits.xenproject.org>
Date: Tue, 04 May 2021 18:23:19 +0000

commit 9478ee4a1501c8899307eaa24585f8c6f8d23fa9
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Apr 30 20:17:55 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue May 4 19:12:47 2021 +0100

    x86/xstate: Elide redundant writes in set_xcr0()
    
    XSETBV is an expensive instruction as, amongst other things, it involves
    reconfiguring the instruction decode at the frontend of the pipeline.
    
    We have several paths which reconfigure %xcr0 in quick succession (the context
    switch path has 5, including the fpu save/restore helpers), and only a single
    caller takes any care to try to skip redundant writes.
    
    Update set_xcr0() to perform amortisation automatically, and simplify the
    __context_switch() path as a consequence.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/domain.c |  4 +---
 xen/arch/x86/xstate.c | 15 +++++++++++----
 2 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index 4dc27f798e..50a27197b5 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -1977,9 +1977,7 @@ static void __context_switch(void)
         memcpy(stack_regs, &n->arch.user_regs, CTXT_SWITCH_STACK_BYTES);
         if ( cpu_has_xsave )
         {
-            u64 xcr0 = n->arch.xcr0 ?: XSTATE_FP_SSE;
-
-            if ( xcr0 != get_xcr0() && !set_xcr0(xcr0) )
+            if ( !set_xcr0(n->arch.xcr0 ?: XSTATE_FP_SSE) )
                 BUG();
 
             if ( cpu_has_xsaves && is_hvm_vcpu(n) )
diff --git a/xen/arch/x86/xstate.c b/xen/arch/x86/xstate.c
index d49413b745..65c720a26a 100644
--- a/xen/arch/x86/xstate.c
+++ b/xen/arch/x86/xstate.c
@@ -55,11 +55,18 @@ static inline bool xsetbv(u32 index, u64 xfeatures)
     return lo != 0;
 }
 
-bool set_xcr0(u64 xfeatures)
+bool set_xcr0(u64 val)
 {
-    if ( !xsetbv(XCR_XFEATURE_ENABLED_MASK, xfeatures) )
-        return false;
-    this_cpu(xcr0) = xfeatures;
+    uint64_t *this_xcr0 = &this_cpu(xcr0);
+
+    if ( *this_xcr0 != val )
+    {
+        if ( !xsetbv(XCR_XFEATURE_ENABLED_MASK, val) )
+            return false;
+
+        *this_xcr0 = val;
+    }
+
     return true;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue May 04 18:23:30 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 May 2021 18:23:30 +0000
Received: from list by lists.xenproject.org with outflank-mailman.122687.231448 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ldzhi-0001Kp-QY; Tue, 04 May 2021 18:23:30 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 122687.231448; Tue, 04 May 2021 18:23:30 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ldzhi-0001Kh-Ng; Tue, 04 May 2021 18:23:30 +0000
Received: by outflank-mailman (input) for mailman id 122687;
 Tue, 04 May 2021 18:23:29 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldzhh-0001KY-RC
 for xen-changelog@lists.xenproject.org; Tue, 04 May 2021 18:23:29 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldzhh-0000NN-QS
 for xen-changelog@lists.xenproject.org; Tue, 04 May 2021 18:23:29 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ldzhh-0001ae-Pc
 for xen-changelog@lists.xenproject.org; Tue, 04 May 2021 18:23:29 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Zjxkg0FWgEUE5RNGbvpR48fYKWqa5b94qqGppj+FT0M=; b=JS7A2/PnmHkdV/bg4BtCFNRzmD
	2lz1mZP2eN7fqepG9ue5+6dIcyMvTLpfAZoawMvRWBAq0T3pJli4f15tIJ6IRtA4c7qPp/LjrnJZS
	ZQAdU2U8t/i3y4ZU8s07lc7ggwg12py4U+psD+tRsJd9BUAYUkCQanGmj+7jRo4DoHdw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/xstate: Rename _xstate_ctxt_size() to hw_uncompressed_size()
Message-Id: <E1ldzhh-0001ae-Pc@xenbits.xenproject.org>
Date: Tue, 04 May 2021 18:23:29 +0000

commit 8cccd6438e86112ab383e41b433b5a7e73be9621
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Apr 30 20:17:55 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue May 4 19:14:23 2021 +0100

    x86/xstate: Rename _xstate_ctxt_size() to hw_uncompressed_size()
    
    The latter is a more descriptive name, as it explicitly highlights the query
    from hardware.
    
    Simplify the internal logic using cpuid_count_ebx(), and drop the curr/max
    assertion as this property is guaranteed by the x86 ISA.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/xstate.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/xen/arch/x86/xstate.c b/xen/arch/x86/xstate.c
index 65c720a26a..6aaf9a2f15 100644
--- a/xen/arch/x86/xstate.c
+++ b/xen/arch/x86/xstate.c
@@ -554,19 +554,18 @@ void xstate_free_save_area(struct vcpu *v)
     v->arch.xsave_area = NULL;
 }
 
-static unsigned int _xstate_ctxt_size(u64 xcr0)
+static unsigned int hw_uncompressed_size(uint64_t xcr0)
 {
     u64 act_xcr0 = get_xcr0();
-    u32 eax, ebx = 0, ecx, edx;
+    unsigned int size;
     bool ok = set_xcr0(xcr0);
 
     ASSERT(ok);
-    cpuid_count(XSTATE_CPUID, 0, &eax, &ebx, &ecx, &edx);
-    ASSERT(ebx <= ecx);
+    size = cpuid_count_ebx(XSTATE_CPUID, 0);
     ok = set_xcr0(act_xcr0);
     ASSERT(ok);
 
-    return ebx;
+    return size;
 }
 
 /* Fastpath for common xstate size requests, avoiding reloads of xcr0. */
@@ -578,7 +577,7 @@ unsigned int xstate_ctxt_size(u64 xcr0)
     if ( xcr0 == 0 )
         return 0;
 
-    return _xstate_ctxt_size(xcr0);
+    return hw_uncompressed_size(xcr0);
 }
 
 static bool valid_xcr0(uint64_t xcr0)
@@ -662,14 +661,14 @@ void xstate_init(struct cpuinfo_x86 *c)
          * xsave_cntxt_size is the max size required by enabled features.
          * We know FP/SSE and YMM about eax, and nothing about edx at present.
          */
-        xsave_cntxt_size = _xstate_ctxt_size(feature_mask);
+        xsave_cntxt_size = hw_uncompressed_size(feature_mask);
         printk("xstate: size: %#x and states: %#"PRIx64"\n",
                xsave_cntxt_size, xfeature_mask);
     }
     else
     {
         BUG_ON(xfeature_mask != feature_mask);
-        BUG_ON(xsave_cntxt_size != _xstate_ctxt_size(feature_mask));
+        BUG_ON(xsave_cntxt_size != hw_uncompressed_size(feature_mask));
     }
 
     if ( setup_xstate_features(bsp) && bsp )
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed May 05 10:33:09 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 05 May 2021 10:33:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.122973.231991 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1leEq0-0000oK-4E; Wed, 05 May 2021 10:33:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 122973.231991; Wed, 05 May 2021 10:33:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1leEq0-0000oC-1D; Wed, 05 May 2021 10:33:04 +0000
Received: by outflank-mailman (input) for mailman id 122973;
 Wed, 05 May 2021 10:33:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1leEpy-0000o5-Go
 for xen-changelog@lists.xenproject.org; Wed, 05 May 2021 10:33:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1leEpy-0007bx-F8
 for xen-changelog@lists.xenproject.org; Wed, 05 May 2021 10:33:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1leEpy-0006wi-E8
 for xen-changelog@lists.xenproject.org; Wed, 05 May 2021 10:33:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=2TzYtkM4XLf/RlOQOg7vubpPY101KKi3GtYPqVImyI0=; b=KabT5cLCzsf6Pf6Q9WxxsO5EVr
	9a4WblPdsCSUG4SNfJ+vxkKs1GNlmAt06xME3xFCe6HXnzNFsWMGci5IDQaPZ1izar4B+Ds2MWa6S
	KTzkDnP3AglCtW0f3QSro9vqXbR1MAIIJIrj0qPckbOXwEK512xW8G/nY1ytNEGuw7GI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.14] SUPPORT.md: Document speculative attacks status of non-shim 32-bit PV
Message-Id: <E1leEpy-0006wi-E8@xenbits.xenproject.org>
Date: Wed, 05 May 2021 10:33:02 +0000

commit 10f0b2d49376865d49680f06c52b451fabce3bb5
Author:     Ian Jackson <ian.jackson@eu.citrix.com>
AuthorDate: Tue Mar 9 15:00:47 2021 +0000
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue May 4 14:58:33 2021 +0200

    SUPPORT.md: Document speculative attacks status of non-shim 32-bit PV
    
    This documents, but does not fix, XSA-370.
    
    Reported-by: Jann Horn <jannh@google.com>
    Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
    Signed-off-by: George Dunlap <george.dunlap@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 SUPPORT.md | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/SUPPORT.md b/SUPPORT.md
index 12e77ab66b..cd786ac0c1 100644
--- a/SUPPORT.md
+++ b/SUPPORT.md
@@ -80,7 +80,16 @@ Traditional Xen PV guest
 
 No hardware requirements
 
-    Status: Supported
+    Status, x86_64: Supported
+    Status, x86_32, shim: Supported
+    Status, x86_32, without shim: Supported, with caveats
+
+Due to architectural limitations,
+32-bit PV guests must be assumed to be able to read arbitrary host memory
+using speculative execution attacks.
+Advisories will continue to be issued
+for new vulnerabilities related to un-shimmed 32-bit PV guests
+enabling denial-of-service attacks or privilege escalation attacks.
 
 ### x86/HVM
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.14


From xen-changelog-bounces@lists.xenproject.org Wed May 05 10:33:14 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 05 May 2021 10:33:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.122974.231996 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1leEqA-0000qd-5n; Wed, 05 May 2021 10:33:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 122974.231996; Wed, 05 May 2021 10:33:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1leEqA-0000qV-2i; Wed, 05 May 2021 10:33:14 +0000
Received: by outflank-mailman (input) for mailman id 122974;
 Wed, 05 May 2021 10:33:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1leEq9-0000qI-0i
 for xen-changelog@lists.xenproject.org; Wed, 05 May 2021 10:33:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1leEq8-0007c2-W9
 for xen-changelog@lists.xenproject.org; Wed, 05 May 2021 10:33:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1leEq8-0006yG-VA
 for xen-changelog@lists.xenproject.org; Wed, 05 May 2021 10:33:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=5jlIqzvM077JTAm9pQ+eseCqL+lgFeqIudedZ0Mt0YU=; b=V/Q5j+r3bH5jQg2PPzNJjR4EqD
	OYvfuhM5bxuC5EwU9NoxHCHMiFKY2rG8+C2Xl5Htga303eNN4hxEn8EsExe57LU2S54FD8uCpem3H
	uQStEK+JRaMfAlBG6AHCplB8YkpytMgbsZtsvcaCumgiA0RMLehexXkEz5zWbMminakw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.11] SUPPORT.md: Document speculative attacks status of non-shim 32-bit PV
Message-Id: <E1leEq8-0006yG-VA@xenbits.xenproject.org>
Date: Wed, 05 May 2021 10:33:12 +0000

commit b1e46bc369bb490b721c77f15d2583bbf466152d
Author:     Ian Jackson <ian.jackson@eu.citrix.com>
AuthorDate: Tue Mar 9 15:00:47 2021 +0000
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue May 4 15:00:24 2021 +0200

    SUPPORT.md: Document speculative attacks status of non-shim 32-bit PV
    
    This documents, but does not fix, XSA-370.
    
    Reported-by: Jann Horn <jannh@google.com>
    Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
    Signed-off-by: George Dunlap <george.dunlap@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 SUPPORT.md | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/SUPPORT.md b/SUPPORT.md
index 8a28a4c0e9..8e75b5afe9 100644
--- a/SUPPORT.md
+++ b/SUPPORT.md
@@ -73,7 +73,16 @@ Traditional Xen PV guest
 
 No hardware requirements
 
-    Status: Supported
+    Status, x86_64: Supported
+    Status, x86_32, shim: Supported
+    Status, x86_32, without shim: Supported, with caveats
+
+Due to architectural limitations,
+32-bit PV guests must be assumed to be able to read arbitrary host memory
+using speculative execution attacks.
+Advisories will continue to be issued
+for new vulnerabilities related to un-shimmed 32-bit PV guests
+enabling denial-of-service attacks or privilege escalation attacks.
 
 ### x86/HVM
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.11


From xen-changelog-bounces@lists.xenproject.org Wed May 05 11:44:06 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 05 May 2021 11:44:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.123027.232091 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1leFwg-00030V-MD; Wed, 05 May 2021 11:44:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 123027.232091; Wed, 05 May 2021 11:44:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1leFwg-00030L-Ij; Wed, 05 May 2021 11:44:02 +0000
Received: by outflank-mailman (input) for mailman id 123027;
 Wed, 05 May 2021 11:44:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1leFwg-00030D-1G
 for xen-changelog@lists.xenproject.org; Wed, 05 May 2021 11:44:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1leFwg-0000NG-0O
 for xen-changelog@lists.xenproject.org; Wed, 05 May 2021 11:44:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1leFwf-0004gk-VF
 for xen-changelog@lists.xenproject.org; Wed, 05 May 2021 11:44:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=SrDAtj3LXdQfQTQbJb+gV77yMF9rB1a2Rh0G1m7d0Oo=; b=hAp20Vbowy0vXsTPNa7WE3Hrpu
	gt7Rujh/fSIomzDfDtl01TZMoY6e5x/ZkZPkY2WHtFhLxGJiBNSQqH813V8v1+vFZqj+Tl2tY0VrF
	tNLPSggS9bMTlvw8Obv62v0gTiBmmZfTc7OTGrT0bJSIGIIsFmhjLgfRcqXkjxLVVTqQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.13] SUPPORT.md: Document speculative attacks status of non-shim 32-bit PV
Message-Id: <E1leFwf-0004gk-VF@xenbits.xenproject.org>
Date: Wed, 05 May 2021 11:44:01 +0000

commit 284132938900ce8c3b11babf7255f5c6dbb21716
Author:     Ian Jackson <ian.jackson@eu.citrix.com>
AuthorDate: Tue Mar 9 15:00:47 2021 +0000
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue May 4 14:59:12 2021 +0200

    SUPPORT.md: Document speculative attacks status of non-shim 32-bit PV
    
    This documents, but does not fix, XSA-370.
    
    Reported-by: Jann Horn <jannh@google.com>
    Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
    Signed-off-by: George Dunlap <george.dunlap@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 SUPPORT.md | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/SUPPORT.md b/SUPPORT.md
index 3b7a1a0a1a..b8fc04e934 100644
--- a/SUPPORT.md
+++ b/SUPPORT.md
@@ -80,7 +80,16 @@ Traditional Xen PV guest
 
 No hardware requirements
 
-    Status: Supported
+    Status, x86_64: Supported
+    Status, x86_32, shim: Supported
+    Status, x86_32, without shim: Supported, with caveats
+
+Due to architectural limitations,
+32-bit PV guests must be assumed to be able to read arbitrary host memory
+using speculative execution attacks.
+Advisories will continue to be issued
+for new vulnerabilities related to un-shimmed 32-bit PV guests
+enabling denial-of-service attacks or privilege escalation attacks.
 
 ### x86/HVM
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.13


From xen-changelog-bounces@lists.xenproject.org Wed May 05 14:33:11 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 05 May 2021 14:33:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.123146.232298 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1leIaI-0002RP-8S; Wed, 05 May 2021 14:33:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 123146.232298; Wed, 05 May 2021 14:33:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1leIaI-0002RH-5b; Wed, 05 May 2021 14:33:06 +0000
Received: by outflank-mailman (input) for mailman id 123146;
 Wed, 05 May 2021 14:33:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1leIaH-0002R9-7e
 for xen-changelog@lists.xenproject.org; Wed, 05 May 2021 14:33:05 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1leIaH-0003IK-3K
 for xen-changelog@lists.xenproject.org; Wed, 05 May 2021 14:33:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1leIaH-00010w-2I
 for xen-changelog@lists.xenproject.org; Wed, 05 May 2021 14:33:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=tA15b5/2esKqN2a0E4N6EleEemsIfxxxsDpnhPg/Q9Q=; b=ZAjhutOt3jyo7RTF23I98MPlVR
	QFOBus4iEmTWVgwj5/xoKWfzEUcEOEiDoB85VUvt3r+A5tygO5guRHvFO7i2Ox84lftrJKrZUihLI
	YhBqUxKoqpisbQq4JHCTLwoRAGNkQsn9xz1PRp2opaddWpr6hGW9j80Q/ppG6HUn+fWU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] automation: save xen config before building
Message-Id: <E1leIaH-00010w-2I@xenbits.xenproject.org>
Date: Wed, 05 May 2021 14:33:05 +0000

commit b066bd195c04f15ca396ce427c03da1e14849197
Author:     Wei Liu <wl@xen.org>
AuthorDate: Wed May 5 11:45:16 2021 +0000
Commit:     Wei Liu <wl@xen.org>
CommitDate: Wed May 5 14:23:01 2021 +0000

    automation: save xen config before building
    
    It is reported that failed randconfig runs are missing the config file
    which makes debugging impossible. Fix this by moving the line that
    copies the config file before the build is executed.
    
    Signed-off-by: Wei Liu <wl@xen.org>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 automation/scripts/build | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/automation/scripts/build b/automation/scripts/build
index eaf70b11d1..46b6903d29 100755
--- a/automation/scripts/build
+++ b/automation/scripts/build
@@ -16,6 +16,10 @@ else
     make -j$(nproc) -C xen defconfig
 fi
 
+# Save the config file before building because build failure causes the script
+# to exit early -- bash is invoked with -e.
+cp xen/.config xen-config
+
 # arm32 only cross-compiles the hypervisor
 if [[ "${XEN_TARGET_ARCH}" = "arm32" ]]; then
     hypervisor_only="y"
@@ -59,7 +63,6 @@ else
 fi
 
 # Extract artifacts to avoid getting rewritten by customised builds
-cp xen/.config xen-config
 mkdir binaries
 if [[ "${XEN_TARGET_ARCH}" != "x86_32" ]]; then
     cp xen/xen binaries/xen
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed May 05 17:33:07 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 05 May 2021 17:33:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.123239.232440 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1leLOR-0007PS-49; Wed, 05 May 2021 17:33:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 123239.232440; Wed, 05 May 2021 17:33:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1leLOR-0007PK-1G; Wed, 05 May 2021 17:33:03 +0000
Received: by outflank-mailman (input) for mailman id 123239;
 Wed, 05 May 2021 17:33:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1leLOQ-0007P7-BJ
 for xen-changelog@lists.xenproject.org; Wed, 05 May 2021 17:33:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1leLOQ-0006pl-A1
 for xen-changelog@lists.xenproject.org; Wed, 05 May 2021 17:33:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1leLOQ-0001dV-8w
 for xen-changelog@lists.xenproject.org; Wed, 05 May 2021 17:33:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=5u5bgFeODRncU1niMGSmrI5iH1EWzPfLsDWdJao0jU8=; b=m5tnYn2Q6dfRF0jh3h55FTlKKD
	6Ou+K2Z6u8qiOPySlcncF1jmiXJhcstHMr50S8mlYAEb9VHxUz0BfhZyX/tiwr+p2n/zpJpVvjOpO
	knifcdozgfwJM09N56xw1Ar0/7TLpLarmiOzJ5UPeP1iyiwqLrk6/EoJtvO4wFB/V8N0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.15] SUPPORT.md: Document speculative attacks status of non-shim 32-bit PV
Message-Id: <E1leLOQ-0001dV-8w@xenbits.xenproject.org>
Date: Wed, 05 May 2021 17:33:02 +0000

commit 280d472f4fca070a10377e318d90cabfc2540810
Author:     Ian Jackson <ian.jackson@eu.citrix.com>
AuthorDate: Tue Mar 9 15:00:47 2021 +0000
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue May 4 14:58:03 2021 +0200

    SUPPORT.md: Document speculative attacks status of non-shim 32-bit PV
    
    This documents, but does not fix, XSA-370.
    
    Reported-by: Jann Horn <jannh@google.com>
    Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
    Signed-off-by: George Dunlap <george.dunlap@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 SUPPORT.md | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/SUPPORT.md b/SUPPORT.md
index d89af5abc8..9024d8a056 100644
--- a/SUPPORT.md
+++ b/SUPPORT.md
@@ -84,7 +84,16 @@ Traditional Xen PV guest
 
 No hardware requirements
 
-    Status: Supported
+    Status, x86_64: Supported
+    Status, x86_32, shim: Supported
+    Status, x86_32, without shim: Supported, with caveats
+
+Due to architectural limitations,
+32-bit PV guests must be assumed to be able to read arbitrary host memory
+using speculative execution attacks.
+Advisories will continue to be issued
+for new vulnerabilities related to un-shimmed 32-bit PV guests
+enabling denial-of-service attacks or privilege escalation attacks.
 
 ### x86/HVM
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.15


From xen-changelog-bounces@lists.xenproject.org Wed May 05 17:55:10 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 05 May 2021 17:55:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.123258.232480 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1leLjm-0002Ws-Hc; Wed, 05 May 2021 17:55:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 123258.232480; Wed, 05 May 2021 17:55:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1leLjm-0002Wk-Ei; Wed, 05 May 2021 17:55:06 +0000
Received: by outflank-mailman (input) for mailman id 123258;
 Wed, 05 May 2021 17:55:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1leLjk-0002We-Hc
 for xen-changelog@lists.xenproject.org; Wed, 05 May 2021 17:55:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1leLjk-0007BS-Dw
 for xen-changelog@lists.xenproject.org; Wed, 05 May 2021 17:55:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1leLjk-0003al-D2
 for xen-changelog@lists.xenproject.org; Wed, 05 May 2021 17:55:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=8Q3DcOywGfOqmwkGwnLRpuj3ArenRdfBY5EJQqvbX38=; b=E2ZSsMg7R/RKwRaMNfrb48JWQv
	r2VJEHmhz4U6j+uhkewy76Lp9Yju7846V/nPYON9tHHW5YMxSWdnZP3QceMGpMiJ2MDR4moi7UWBI
	QLdjQj05L2n5/MmqloEOarJI1UpDXFND+6rt9yaMOGcNZ4HjxtBmWq9h0XF4ZgpRA0Mc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/xl: Use const whenever we point to literal strings
Message-Id: <E1leLjk-0003al-D2@xenbits.xenproject.org>
Date: Wed, 05 May 2021 17:55:04 +0000

commit e921931feccc8406d5a968e3f97827095b02ce96
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Wed May 5 18:43:06 2021 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Wed May 5 18:43:06 2021 +0100

    tools/xl: Use const whenever we point to literal strings
    
    literal strings are not meant to be modified. So we should use const
    char * rather than char * when we want to store a pointer to them.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
---
 tools/xl/xl.h         | 8 ++++----
 tools/xl/xl_console.c | 2 +-
 tools/xl/xl_utils.c   | 4 ++--
 tools/xl/xl_utils.h   | 4 ++--
 4 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/tools/xl/xl.h b/tools/xl/xl.h
index e5a106dfbc..7e23f30192 100644
--- a/tools/xl/xl.h
+++ b/tools/xl/xl.h
@@ -21,13 +21,13 @@
 #include <xentoollog.h>
 
 struct cmd_spec {
-    char *cmd_name;
+    const char *cmd_name;
     int (*cmd_impl)(int argc, char **argv);
     int can_dryrun;
     int modifies;
-    char *cmd_desc;
-    char *cmd_usage;
-    char *cmd_option;
+    const char *cmd_desc;
+    const char *cmd_usage;
+    const char *cmd_option;
 };
 
 struct domain_create {
diff --git a/tools/xl/xl_console.c b/tools/xl/xl_console.c
index 4e65d73867..b27f9e0136 100644
--- a/tools/xl/xl_console.c
+++ b/tools/xl/xl_console.c
@@ -27,7 +27,7 @@ int main_console(int argc, char **argv)
     uint32_t domid;
     int opt = 0, num = 0;
     libxl_console_type type = 0;
-    char *console_names = "pv, serial, vuart";
+    const char *console_names = "pv, serial, vuart";
 
     SWITCH_FOREACH_OPT(opt, "n:t:", NULL, "console", 1) {
     case 't':
diff --git a/tools/xl/xl_utils.c b/tools/xl/xl_utils.c
index 4503ac7ea0..17489d1829 100644
--- a/tools/xl/xl_utils.c
+++ b/tools/xl/xl_utils.c
@@ -27,7 +27,7 @@
 #include "xl.h"
 #include "xl_utils.h"
 
-void dolog(const char *file, int line, const char *func, char *fmt, ...)
+void dolog(const char *file, int line, const char *func, const char *fmt, ...)
 {
     va_list ap;
     char *s = NULL;
@@ -248,7 +248,7 @@ void print_bitmap(uint8_t *map, int maplen, FILE *stream)
     }
 }
 
-int do_daemonize(char *name, const char *pidfile)
+int do_daemonize(const char *name, const char *pidfile)
 {
     char *fullname;
     pid_t child1;
diff --git a/tools/xl/xl_utils.h b/tools/xl/xl_utils.h
index d98b419f10..0c337ede95 100644
--- a/tools/xl/xl_utils.h
+++ b/tools/xl/xl_utils.h
@@ -123,7 +123,7 @@ int def_getopt(int argc, char * const argv[],
                const struct option *longopts,
                const char* helpstr, int reqargs);
 
-void dolog(const char *file, int line, const char *func, char *fmt, ...)
+void dolog(const char *file, int line, const char *func, const char *fmt, ...)
 	__attribute__((format(printf,4,5)));
 
 void xvasprintf(char **strp, const char *fmt, va_list ap)
@@ -143,7 +143,7 @@ uint32_t find_domain(const char *p) __attribute__((warn_unused_result));
 
 void print_bitmap(uint8_t *map, int maplen, FILE *stream);
 
-int do_daemonize(char *name, const char *pidfile);
+int do_daemonize(const char *name, const char *pidfile);
 #endif /* XL_UTILS_H */
 
 /*
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed May 05 21:55:13 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 05 May 2021 21:55:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.123317.232574 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lePU2-00010O-Vf; Wed, 05 May 2021 21:55:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 123317.232574; Wed, 05 May 2021 21:55:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lePU2-00010G-Sl; Wed, 05 May 2021 21:55:06 +0000
Received: by outflank-mailman (input) for mailman id 123317;
 Wed, 05 May 2021 21:55:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lePU1-00010A-7D
 for xen-changelog@lists.xenproject.org; Wed, 05 May 2021 21:55:05 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lePU1-0002tJ-3f
 for xen-changelog@lists.xenproject.org; Wed, 05 May 2021 21:55:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lePU1-000787-2n
 for xen-changelog@lists.xenproject.org; Wed, 05 May 2021 21:55:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=vBfzMEwHBEqIMayWFjWm/gYP+c8olOxygAysoDSgYMU=; b=bAoyd0ivLJgkxG4DttIYV3Btpp
	r1hAyOdNfKFObSB9Zkka/UOWpfgVhLI3IEhqJKITc+jyq9ZXg+rW8h1xC/ShqM1dyKkTh7c0OKCFU
	9Ng230H0RNhceS/E+vTCu9biV6KTwZZS5A3ohT1ZT2NrSD0hQsEpUplFKkLNamPWnsJc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] libs/guest: Don't hide the indirection on xc_cpu_policy_t
Message-Id: <E1lePU1-000787-2n@xenbits.xenproject.org>
Date: Wed, 05 May 2021 21:55:05 +0000

commit e19b01c186e061e23fac80ff7cbf83e622f384fe
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue May 4 19:40:47 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed May 5 20:20:42 2021 +0100

    libs/guest: Don't hide the indirection on xc_cpu_policy_t
    
    It is bad form in C, perhaps best demonstrated by trying to read
    xc_cpu_policy_destroy(), and causes const qualification to have
    less-than-obvious behaviour (the hidden pointer becomes const, not the thing
    it points at).
    
    xc_cpu_policy_set_domain() needs to drop its (now normal) const qualification,
    as the policy object is modified by the serialisation operation.
    
    This also shows up a problem with the x86_cpu_policies_are_compatible(), where
    the intermediate pointers are non-const.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 tools/include/xenctrl.h             | 22 +++++++++++-----------
 tools/libs/guest/xg_cpuid_x86.c     | 22 +++++++++++-----------
 tools/libs/guest/xg_sr_common_x86.c |  2 +-
 tools/misc/xen-cpuid.c              |  2 +-
 4 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/tools/include/xenctrl.h b/tools/include/xenctrl.h
index 0fdb2e8885..58d3377d6a 100644
--- a/tools/include/xenctrl.h
+++ b/tools/include/xenctrl.h
@@ -2590,33 +2590,33 @@ int xc_psr_get_domain_data(xc_interface *xch, uint32_t domid,
 int xc_psr_get_hw_info(xc_interface *xch, uint32_t socket,
                        xc_psr_feat_type type, xc_psr_hw_info *hw_info);
 
-typedef struct xc_cpu_policy *xc_cpu_policy_t;
+typedef struct xc_cpu_policy xc_cpu_policy_t;
 
 /* Create and free a xc_cpu_policy object. */
-xc_cpu_policy_t xc_cpu_policy_init(void);
-void xc_cpu_policy_destroy(xc_cpu_policy_t policy);
+xc_cpu_policy_t *xc_cpu_policy_init(void);
+void xc_cpu_policy_destroy(xc_cpu_policy_t *policy);
 
 /* Retrieve a system policy, or get/set a domains policy. */
 int xc_cpu_policy_get_system(xc_interface *xch, unsigned int policy_idx,
-                             xc_cpu_policy_t policy);
+                             xc_cpu_policy_t *policy);
 int xc_cpu_policy_get_domain(xc_interface *xch, uint32_t domid,
-                             xc_cpu_policy_t policy);
+                             xc_cpu_policy_t *policy);
 int xc_cpu_policy_set_domain(xc_interface *xch, uint32_t domid,
-                             const xc_cpu_policy_t policy);
+                             xc_cpu_policy_t *policy);
 
 /* Manipulate a policy via architectural representations. */
-int xc_cpu_policy_serialise(xc_interface *xch, const xc_cpu_policy_t policy,
+int xc_cpu_policy_serialise(xc_interface *xch, const xc_cpu_policy_t *policy,
                             xen_cpuid_leaf_t *leaves, uint32_t *nr_leaves,
                             xen_msr_entry_t *msrs, uint32_t *nr_msrs);
-int xc_cpu_policy_update_cpuid(xc_interface *xch, xc_cpu_policy_t policy,
+int xc_cpu_policy_update_cpuid(xc_interface *xch, xc_cpu_policy_t *policy,
                                const xen_cpuid_leaf_t *leaves,
                                uint32_t nr);
-int xc_cpu_policy_update_msrs(xc_interface *xch, xc_cpu_policy_t policy,
+int xc_cpu_policy_update_msrs(xc_interface *xch, xc_cpu_policy_t *policy,
                               const xen_msr_entry_t *msrs, uint32_t nr);
 
 /* Compatibility calculations. */
-bool xc_cpu_policy_is_compatible(xc_interface *xch, const xc_cpu_policy_t host,
-                                 const xc_cpu_policy_t guest);
+bool xc_cpu_policy_is_compatible(xc_interface *xch, xc_cpu_policy_t *host,
+                                 xc_cpu_policy_t *guest);
 
 int xc_get_cpu_levelling_caps(xc_interface *xch, uint32_t *caps);
 int xc_get_cpu_featureset(xc_interface *xch, uint32_t index,
diff --git a/tools/libs/guest/xg_cpuid_x86.c b/tools/libs/guest/xg_cpuid_x86.c
index d4e02cecb1..1ebc108213 100644
--- a/tools/libs/guest/xg_cpuid_x86.c
+++ b/tools/libs/guest/xg_cpuid_x86.c
@@ -672,18 +672,18 @@ out:
     return rc;
 }
 
-xc_cpu_policy_t xc_cpu_policy_init(void)
+xc_cpu_policy_t *xc_cpu_policy_init(void)
 {
     return calloc(1, sizeof(struct xc_cpu_policy));
 }
 
-void xc_cpu_policy_destroy(xc_cpu_policy_t policy)
+void xc_cpu_policy_destroy(xc_cpu_policy_t *policy)
 {
     if ( policy )
         free(policy);
 }
 
-static int deserialize_policy(xc_interface *xch, xc_cpu_policy_t policy,
+static int deserialize_policy(xc_interface *xch, xc_cpu_policy_t *policy,
                               unsigned int nr_leaves, unsigned int nr_entries)
 {
     uint32_t err_leaf = -1, err_subleaf = -1, err_msr = -1;
@@ -713,7 +713,7 @@ static int deserialize_policy(xc_interface *xch, xc_cpu_policy_t policy,
 }
 
 int xc_cpu_policy_get_system(xc_interface *xch, unsigned int policy_idx,
-                             xc_cpu_policy_t policy)
+                             xc_cpu_policy_t *policy)
 {
     unsigned int nr_leaves = ARRAY_SIZE(policy->leaves);
     unsigned int nr_entries = ARRAY_SIZE(policy->entries);
@@ -738,7 +738,7 @@ int xc_cpu_policy_get_system(xc_interface *xch, unsigned int policy_idx,
 }
 
 int xc_cpu_policy_get_domain(xc_interface *xch, uint32_t domid,
-                             xc_cpu_policy_t policy)
+                             xc_cpu_policy_t *policy)
 {
     unsigned int nr_leaves = ARRAY_SIZE(policy->leaves);
     unsigned int nr_entries = ARRAY_SIZE(policy->entries);
@@ -763,7 +763,7 @@ int xc_cpu_policy_get_domain(xc_interface *xch, uint32_t domid,
 }
 
 int xc_cpu_policy_set_domain(xc_interface *xch, uint32_t domid,
-                             const xc_cpu_policy_t policy)
+                             xc_cpu_policy_t *policy)
 {
     uint32_t err_leaf = -1, err_subleaf = -1, err_msr = -1;
     unsigned int nr_leaves = ARRAY_SIZE(policy->leaves);
@@ -791,7 +791,7 @@ int xc_cpu_policy_set_domain(xc_interface *xch, uint32_t domid,
     return rc;
 }
 
-int xc_cpu_policy_serialise(xc_interface *xch, const xc_cpu_policy_t p,
+int xc_cpu_policy_serialise(xc_interface *xch, const xc_cpu_policy_t *p,
                             xen_cpuid_leaf_t *leaves, uint32_t *nr_leaves,
                             xen_msr_entry_t *msrs, uint32_t *nr_msrs)
 {
@@ -823,7 +823,7 @@ int xc_cpu_policy_serialise(xc_interface *xch, const xc_cpu_policy_t p,
     return 0;
 }
 
-int xc_cpu_policy_update_cpuid(xc_interface *xch, xc_cpu_policy_t policy,
+int xc_cpu_policy_update_cpuid(xc_interface *xch, xc_cpu_policy_t *policy,
                                const xen_cpuid_leaf_t *leaves,
                                uint32_t nr)
 {
@@ -843,7 +843,7 @@ int xc_cpu_policy_update_cpuid(xc_interface *xch, xc_cpu_policy_t policy,
     return rc;
 }
 
-int xc_cpu_policy_update_msrs(xc_interface *xch, xc_cpu_policy_t policy,
+int xc_cpu_policy_update_msrs(xc_interface *xch, xc_cpu_policy_t *policy,
                               const xen_msr_entry_t *msrs, uint32_t nr)
 {
     unsigned int err_msr = -1;
@@ -861,8 +861,8 @@ int xc_cpu_policy_update_msrs(xc_interface *xch, xc_cpu_policy_t policy,
     return rc;
 }
 
-bool xc_cpu_policy_is_compatible(xc_interface *xch, const xc_cpu_policy_t host,
-                                 const xc_cpu_policy_t guest)
+bool xc_cpu_policy_is_compatible(xc_interface *xch, xc_cpu_policy_t *host,
+                                 xc_cpu_policy_t *guest)
 {
     struct cpu_policy_errors err = INIT_CPU_POLICY_ERRORS;
     struct cpu_policy h = { &host->cpuid, &host->msr };
diff --git a/tools/libs/guest/xg_sr_common_x86.c b/tools/libs/guest/xg_sr_common_x86.c
index 15265e7a33..563b4f0168 100644
--- a/tools/libs/guest/xg_sr_common_x86.c
+++ b/tools/libs/guest/xg_sr_common_x86.c
@@ -48,7 +48,7 @@ int write_x86_cpu_policy_records(struct xc_sr_context *ctx)
     struct xc_sr_record cpuid = { .type = REC_TYPE_X86_CPUID_POLICY, };
     struct xc_sr_record msrs  = { .type = REC_TYPE_X86_MSR_POLICY, };
     uint32_t nr_leaves = 0, nr_msrs = 0;
-    xc_cpu_policy_t policy = NULL;
+    xc_cpu_policy_t *policy = NULL;
     int rc;
 
     if ( xc_cpu_policy_get_size(xch, &nr_leaves, &nr_msrs) < 0 )
diff --git a/tools/misc/xen-cpuid.c b/tools/misc/xen-cpuid.c
index b2a36deacc..d4bc83d8c9 100644
--- a/tools/misc/xen-cpuid.c
+++ b/tools/misc/xen-cpuid.c
@@ -468,7 +468,7 @@ int main(int argc, char **argv)
         uint32_t i, max_leaves, max_msrs;
 
         xc_interface *xch = xc_interface_open(0, 0, 0);
-        xc_cpu_policy_t policy = xc_cpu_policy_init();
+        xc_cpu_policy_t *policy = xc_cpu_policy_init();
 
         if ( !xch )
             err(1, "xc_interface_open");
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed May 05 21:55:16 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 05 May 2021 21:55:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.123318.232578 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lePUC-000120-0i; Wed, 05 May 2021 21:55:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 123318.232578; Wed, 05 May 2021 21:55:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lePUB-00011s-UF; Wed, 05 May 2021 21:55:15 +0000
Received: by outflank-mailman (input) for mailman id 123318;
 Wed, 05 May 2021 21:55:15 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lePUB-00011m-7u
 for xen-changelog@lists.xenproject.org; Wed, 05 May 2021 21:55:15 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lePUB-0002tN-70
 for xen-changelog@lists.xenproject.org; Wed, 05 May 2021 21:55:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lePUB-000793-63
 for xen-changelog@lists.xenproject.org; Wed, 05 May 2021 21:55:15 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=2xufSNwzPgaqeNwnC5HhNjTYEwsXiwka/yLfdFT5YPw=; b=kKvnuTR9F0l4yC6SO9EvxcRKqf
	B3F0xGr5eNpppPBUkzuKLzc6mxRhdXW9EVmQwrr/Hp+4LtFVTYsGFKHhTY2bXOcJaj7DdhXsrNPPE
	++mj1OSBHyHYcUFCRjD77+2m4LCODxUVgEAADRI81zbGjbtIx/yh5Vi27RoJqMWcQrk0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/p2m: please Clang after making certain parts HVM-only
Message-Id: <E1lePUB-000793-63@xenbits.xenproject.org>
Date: Wed, 05 May 2021 21:55:15 +0000

commit 09fc903c5ac042e2e1eb54e58ea7f207ed12ee16
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed May 5 09:07:30 2021 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed May 5 20:20:42 2021 +0100

    x86/p2m: please Clang after making certain parts HVM-only
    
    Move a few #ifdef-s, to account for diagnostics like
    
    p2m.c:549:1: error: non-void function does not return a value in all control paths [-Werror,-Wreturn-type]
    
    which appear despite paging_mode_translate() resolving to constant
    "false" when !HVM. All of the affected functions are intended to become
    fully HVM-only anyway, with their non-translated stub handling split off
    elsewhere.
    
    Fixes: 8d012d3ddffc ("x86/p2m: {get,set}_entry hooks and p2m-pt.c are HVM-only")
    Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/mm/p2m.c | 26 ++++++++++++++------------
 1 file changed, 14 insertions(+), 12 deletions(-)

diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
index 8f4816c414..dbb1cbeb59 100644
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -497,21 +497,23 @@ mfn_t __get_gfn_type_access(struct p2m_domain *p2m, unsigned long gfn_l,
 #ifdef CONFIG_HVM
     mfn_t mfn;
     gfn_t gfn = _gfn(gfn_l);
-#endif
-
-    /* Unshare makes no sense withuot populate. */
-    if ( q & P2M_UNSHARE )
-        q |= P2M_ALLOC;
 
     if ( !p2m || !paging_mode_translate(p2m->domain) )
     {
-        /* Not necessarily true, but for non-translated guests, we claim
-         * it's the most generic kind of memory */
+#endif
+        /*
+         * Not necessarily true, but for non-translated guests we claim
+         * it's the most generic kind of memory.
+         */
         *t = p2m_ram_rw;
         return _mfn(gfn_l);
+#ifdef CONFIG_HVM
     }
 
-#ifdef CONFIG_HVM
+    /* Unshare makes no sense without populate. */
+    if ( q & P2M_UNSHARE )
+        q |= P2M_ALLOC;
+
     if ( locked )
         /* Grab the lock here, don't release until put_gfn */
         gfn_lock(p2m, gfn, 0);
@@ -1417,18 +1419,18 @@ int set_identity_p2m_entry(struct domain *d, unsigned long gfn_l,
     mfn_t mfn;
     struct p2m_domain *p2m = p2m_get_hostp2m(d);
     int ret;
-#endif
 
     if ( !paging_mode_translate(d) )
     {
+#endif
         if ( !is_iommu_enabled(d) )
             return 0;
         return iommu_legacy_map(d, _dfn(gfn_l), _mfn(gfn_l),
                                 1ul << PAGE_ORDER_4K,
                                 IOMMUF_readable | IOMMUF_writable);
+#ifdef CONFIG_HVM
     }
 
-#ifdef CONFIG_HVM
     gfn_lock(p2m, gfn, 0);
 
     mfn = p2m->get_entry(p2m, gfn, &p2mt, &a, 0, NULL, NULL);
@@ -1464,16 +1466,16 @@ int clear_identity_p2m_entry(struct domain *d, unsigned long gfn_l)
     mfn_t mfn;
     struct p2m_domain *p2m = p2m_get_hostp2m(d);
     int ret;
-#endif
 
     if ( !paging_mode_translate(d) )
     {
+#endif
         if ( !is_iommu_enabled(d) )
             return 0;
         return iommu_legacy_unmap(d, _dfn(gfn_l), 1ul << PAGE_ORDER_4K);
+#ifdef CONFIG_HVM
     }
 
-#ifdef CONFIG_HVM
     gfn_lock(p2m, gfn, 0);
 
     mfn = p2m->get_entry(p2m, gfn, &p2mt, &a, 0, NULL, NULL);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu May 06 12:33:10 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 06 May 2021 12:33:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.123454.232837 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ledBf-0000RA-QL; Thu, 06 May 2021 12:33:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 123454.232837; Thu, 06 May 2021 12:33:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ledBf-0000R2-NE; Thu, 06 May 2021 12:33:03 +0000
Received: by outflank-mailman (input) for mailman id 123454;
 Thu, 06 May 2021 12:33:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ledBe-0000Qw-4n
 for xen-changelog@lists.xenproject.org; Thu, 06 May 2021 12:33:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ledBe-0007y9-3c
 for xen-changelog@lists.xenproject.org; Thu, 06 May 2021 12:33:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ledBe-0002iJ-2c
 for xen-changelog@lists.xenproject.org; Thu, 06 May 2021 12:33:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=JAkEpJSO9m8jlZ5g+lwo0k0ZJmFkDNAaDZHjxn956KI=; b=mqa3sStMe6KdjjBSQTioIy/rYz
	rOAtaSn9x9LQiJtrce+koEAczK0FT/R6UAzjg//8ObrOblj5mlvE9gGHmT144Z0EB2ZnllLpcbc5k
	u/yq9zQyDLjqz+f4UbYpEBXRsWP9X4svrlRsIn0Q91Yl5q/erYH8R6udfu0kMzlrvow8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/shim: don't permit HVM and PV_SHIM_EXCLUSIVE at the same time
Message-Id: <E1ledBe-0002iJ-2c@xenbits.xenproject.org>
Date: Thu, 06 May 2021 12:33:02 +0000

commit 075926410e997cc564c6b6ac6ddf17bc5459b445
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue May 4 10:49:22 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue May 4 10:49:22 2021 +0200

    x86/shim: don't permit HVM and PV_SHIM_EXCLUSIVE at the same time
    
    This combination doesn't really make sense (and there likely are more);
    in particular even if the code built with both options set, HVM guests
    wouldn't work (and I think one wouldn't be able to create one in the
    first place). The alternative here would be some presumably intrusive
    #ifdef-ary to get this combination to actually build (but still not
    work) again.
    
    Fixes: 8b5b49ceb3d9 ("x86: don't include domctl and alike in shim-exclusive builds")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/Kconfig | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/Kconfig b/xen/arch/x86/Kconfig
index 271b098fb5..e55e029b79 100644
--- a/xen/arch/x86/Kconfig
+++ b/xen/arch/x86/Kconfig
@@ -22,7 +22,7 @@ config X86
 	select HAS_PDX
 	select HAS_SCHED_GRANULARITY
 	select HAS_UBSAN
-	select HAS_VPCI if !PV_SHIM_EXCLUSIVE && HVM
+	select HAS_VPCI if HVM
 	select NEEDS_LIBELF
 	select NUMA
 
@@ -90,11 +90,12 @@ config PV_LINEAR_PT
          If unsure, say Y.
 
 config HVM
-	def_bool !PV_SHIM_EXCLUSIVE
+	bool "HVM support"
+	depends on !PV_SHIM_EXCLUSIVE
+	default !PV_SHIM
 	select COMPAT
 	select IOREQ_SERVER
 	select MEM_ACCESS_ALWAYS_ON
-	prompt "HVM support"
 	---help---
 	  Interfaces to support HVM domains.  HVM domains require hardware
 	  virtualisation extensions (e.g. Intel VT-x, AMD SVM), but can boot
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu May 06 12:33:13 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 06 May 2021 12:33:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.123455.232841 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ledBp-0000TQ-Rh; Thu, 06 May 2021 12:33:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 123455.232841; Thu, 06 May 2021 12:33:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ledBp-0000TI-Om; Thu, 06 May 2021 12:33:13 +0000
Received: by outflank-mailman (input) for mailman id 123455;
 Thu, 06 May 2021 12:33:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ledBo-0000So-BS
 for xen-changelog@lists.xenproject.org; Thu, 06 May 2021 12:33:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ledBo-0007yX-75
 for xen-changelog@lists.xenproject.org; Thu, 06 May 2021 12:33:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ledBo-0002jE-63
 for xen-changelog@lists.xenproject.org; Thu, 06 May 2021 12:33:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=huP4AzcfraxFiMWyl0Vua3eBR8JWGz1XW0QZ4Lp2pcQ=; b=mxarRlIp4w9cLk+HWtw5c3h3Wt
	9TkaoDv0TylTgAuFDbPmh60UFY/1khqFprN1plQnFjONbhbrCVhsT75vYGI2CY2diMXmEhUfPaFV5
	DE7HYv07TY1yN5ofpO8rwxkLxfdeQSbcdUFNoauOzfd4XWFnwSdsRwq56J83GkXtiONk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/time: avoid reading the platform timer in rendezvous functions
Message-Id: <E1ledBo-0002jE-63@xenbits.xenproject.org>
Date: Thu, 06 May 2021 12:33:12 +0000

commit 48bb237fca65e2bcec7dbe7f4b178cf33c5e15f0
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue May 4 10:49:59 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue May 4 10:49:59 2021 +0200

    x86/time: avoid reading the platform timer in rendezvous functions
    
    Reading the platform timer isn't cheap, so we'd better avoid it when the
    resulting value is of no interest to anyone.
    
    The consumer of master_stime, obtained by
    time_calibration_{std,tsc}_rendezvous() and propagated through
    this_cpu(cpu_calibration), is local_time_calibration(). With
    CONSTANT_TSC the latter function uses an early exit path, which doesn't
    explicitly use the field. While this_cpu(cpu_calibration) (including the
    master_stime field) gets propagated to this_cpu(cpu_time).stamp on that
    path, both structures' fields get consumed only by the !CONSTANT_TSC
    logic of the function.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/time.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c
index 5578b7b3a2..10418cdc54 100644
--- a/xen/arch/x86/time.c
+++ b/xen/arch/x86/time.c
@@ -52,6 +52,7 @@ unsigned long pit0_ticks;
 struct cpu_time_stamp {
     u64 local_tsc;
     s_time_t local_stime;
+    /* Next field unconditionally valid only when !CONSTANT_TSC. */
     s_time_t master_stime;
 };
 
@@ -1702,7 +1703,7 @@ static void time_calibration_tsc_rendezvous(void *_r)
                  * iteration.
                  */
                 r->master_tsc_stamp = r->max_tsc_stamp;
-            else if ( i == 0 )
+            else if ( !boot_cpu_has(X86_FEATURE_CONSTANT_TSC) && i == 0 )
                 r->master_stime = read_platform_stime(NULL);
 
             atomic_inc(&r->semaphore);
@@ -1776,8 +1777,11 @@ static void time_calibration_std_rendezvous(void *_r)
     {
         while ( atomic_read(&r->semaphore) != (total_cpus - 1) )
             cpu_relax();
-        r->master_stime = read_platform_stime(NULL);
-        smp_wmb(); /* write r->master_stime /then/ signal */
+        if ( !boot_cpu_has(X86_FEATURE_CONSTANT_TSC) )
+        {
+            r->master_stime = read_platform_stime(NULL);
+            smp_wmb(); /* write r->master_stime /then/ signal */
+        }
         atomic_inc(&r->semaphore);
     }
     else
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu May 06 12:33:23 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 06 May 2021 12:33:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.123456.232845 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ledBz-0000W3-TK; Thu, 06 May 2021 12:33:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 123456.232845; Thu, 06 May 2021 12:33:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ledBz-0000Vv-QN; Thu, 06 May 2021 12:33:23 +0000
Received: by outflank-mailman (input) for mailman id 123456;
 Thu, 06 May 2021 12:33:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ledBy-0000Ve-Az
 for xen-changelog@lists.xenproject.org; Thu, 06 May 2021 12:33:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ledBy-0007yl-AG
 for xen-changelog@lists.xenproject.org; Thu, 06 May 2021 12:33:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ledBy-0002lb-9O
 for xen-changelog@lists.xenproject.org; Thu, 06 May 2021 12:33:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=++VbPLX9cvLAwnYNHGlBK17Ijv7YpCHNttJ/759eXoE=; b=qmFMcAz2G6nrKN9kTCUuCUM38S
	IgglXwoYTxAvQEJth62jXmQul1cD3zxItsnGEatqe/4/GzJsjhRiE0/Q41Aftiz0qncQHhHOmiy1y
	Q/H2PzwLA86EC1bit2pXLX/yw/3YY27gW3NChBIVCWQZlLZNWdtOt3p4gCLAfUbhAgps=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/xstate: re-use valid_xcr0() for boot-time checks
Message-Id: <E1ledBy-0002lb-9O@xenbits.xenproject.org>
Date: Thu, 06 May 2021 12:33:22 +0000

commit e927a3b89ae82ac875aafedbefd6b4bc46201b7d
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue May 4 10:50:32 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue May 4 10:50:32 2021 +0200

    x86/xstate: re-use valid_xcr0() for boot-time checks
    
    Instead of (just partially) open-coding it, re-use the function after
    suitably moving it up.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/xstate.c | 58 ++++++++++++++++++++++++++-------------------------
 1 file changed, 30 insertions(+), 28 deletions(-)

diff --git a/xen/arch/x86/xstate.c b/xen/arch/x86/xstate.c
index 3794d9a5a5..d49413b745 100644
--- a/xen/arch/x86/xstate.c
+++ b/xen/arch/x86/xstate.c
@@ -574,6 +574,34 @@ unsigned int xstate_ctxt_size(u64 xcr0)
     return _xstate_ctxt_size(xcr0);
 }
 
+static bool valid_xcr0(uint64_t xcr0)
+{
+    /* FP must be unconditionally set. */
+    if ( !(xcr0 & X86_XCR0_FP) )
+        return false;
+
+    /* YMM depends on SSE. */
+    if ( (xcr0 & X86_XCR0_YMM) && !(xcr0 & X86_XCR0_SSE) )
+        return false;
+
+    if ( xcr0 & (X86_XCR0_OPMASK | X86_XCR0_ZMM | X86_XCR0_HI_ZMM) )
+    {
+        /* OPMASK, ZMM, and HI_ZMM require YMM. */
+        if ( !(xcr0 & X86_XCR0_YMM) )
+            return false;
+
+        /* OPMASK, ZMM, and HI_ZMM must be the same. */
+        if ( ~xcr0 & (X86_XCR0_OPMASK | X86_XCR0_ZMM | X86_XCR0_HI_ZMM) )
+            return false;
+    }
+
+    /* BNDREGS and BNDCSR must be the same. */
+    if ( !(xcr0 & X86_XCR0_BNDREGS) != !(xcr0 & X86_XCR0_BNDCSR) )
+        return false;
+
+    return true;
+}
+
 /* Collect the information of processor's extended state */
 void xstate_init(struct cpuinfo_x86 *c)
 {
@@ -609,10 +637,9 @@ void xstate_init(struct cpuinfo_x86 *c)
     }
 
     cpuid_count(XSTATE_CPUID, 0, &eax, &ebx, &ecx, &edx);
-
-    BUG_ON((eax & XSTATE_FP_SSE) != XSTATE_FP_SSE);
-    BUG_ON((eax & X86_XCR0_YMM) && !(eax & X86_XCR0_SSE));
     feature_mask = (((u64)edx << 32) | eax) & XCNTXT_MASK;
+    BUG_ON(!valid_xcr0(feature_mask));
+    BUG_ON(!(feature_mask & X86_XCR0_SSE));
 
     /*
      * Set CR4_OSXSAVE and run "cpuid" to get xsave_cntxt_size.
@@ -642,31 +669,6 @@ void xstate_init(struct cpuinfo_x86 *c)
         BUG();
 }
 
-static bool valid_xcr0(u64 xcr0)
-{
-    /* FP must be unconditionally set. */
-    if ( !(xcr0 & X86_XCR0_FP) )
-        return false;
-
-    /* YMM depends on SSE. */
-    if ( (xcr0 & X86_XCR0_YMM) && !(xcr0 & X86_XCR0_SSE) )
-        return false;
-
-    if ( xcr0 & (X86_XCR0_OPMASK | X86_XCR0_ZMM | X86_XCR0_HI_ZMM) )
-    {
-        /* OPMASK, ZMM, and HI_ZMM require YMM. */
-        if ( !(xcr0 & X86_XCR0_YMM) )
-            return false;
-
-        /* OPMASK, ZMM, and HI_ZMM must be the same. */
-        if ( ~xcr0 & (X86_XCR0_OPMASK | X86_XCR0_ZMM | X86_XCR0_HI_ZMM) )
-            return false;
-    }
-
-    /* BNDREGS and BNDCSR must be the same. */
-    return !(xcr0 & X86_XCR0_BNDREGS) == !(xcr0 & X86_XCR0_BNDCSR);
-}
-
 int validate_xstate(const struct domain *d, uint64_t xcr0, uint64_t xcr0_accum,
                     const struct xsave_hdr *hdr)
 {
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu May 06 12:33:34 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 06 May 2021 12:33:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.123457.232850 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ledC9-0000Yx-VR; Thu, 06 May 2021 12:33:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 123457.232850; Thu, 06 May 2021 12:33:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ledC9-0000Yn-S3; Thu, 06 May 2021 12:33:33 +0000
Received: by outflank-mailman (input) for mailman id 123457;
 Thu, 06 May 2021 12:33:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ledC8-0000YX-E7
 for xen-changelog@lists.xenproject.org; Thu, 06 May 2021 12:33:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ledC8-0007z2-DL
 for xen-changelog@lists.xenproject.org; Thu, 06 May 2021 12:33:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ledC8-0002mH-Cb
 for xen-changelog@lists.xenproject.org; Thu, 06 May 2021 12:33:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=pimPK5NuJbA1IFWt6l1cwFeV9RVGAkWYfOaormlL8vM=; b=lQffK8syuios7rGMtQSnmjKJzB
	MgDq00/bc/fg8V8tisogdIhCbUYvnJ5qPlOHFHjwVcGxqLODRwrCjH1z4qKXm1MRmkP/ru5/Aacv+
	xb+/Gm8s++9D1tl6+7et798PxTTdJQMDgRyyscVpJBt1dPGzmpUhQjRzDAtWLKB/HkPM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] SUPPORT.md: Document speculative attacks status of non-shim 32-bit PV
Message-Id: <E1ledC8-0002mH-Cb@xenbits.xenproject.org>
Date: Thu, 06 May 2021 12:33:32 +0000

commit ec4b43107f8663b4a3cf6b9605e1d80152a89f49
Author:     Ian Jackson <ian.jackson@eu.citrix.com>
AuthorDate: Tue Mar 9 15:00:47 2021 +0000
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue May 4 14:14:40 2021 +0200

    SUPPORT.md: Document speculative attacks status of non-shim 32-bit PV
    
    This documents, but does not fix, XSA-370.
    
    Reported-by: Jann Horn <jannh@google.com>
    Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
    Signed-off-by: George Dunlap <george.dunlap@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 SUPPORT.md | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/SUPPORT.md b/SUPPORT.md
index d0b8afe41c..d0d4fc6f4f 100644
--- a/SUPPORT.md
+++ b/SUPPORT.md
@@ -84,7 +84,16 @@ Traditional Xen PV guest
 
 No hardware requirements
 
-    Status: Supported
+    Status, x86_64: Supported
+    Status, x86_32, shim: Supported
+    Status, x86_32, without shim: Supported, with caveats
+
+Due to architectural limitations,
+32-bit PV guests must be assumed to be able to read arbitrary host memory
+using speculative execution attacks.
+Advisories will continue to be issued
+for new vulnerabilities related to un-shimmed 32-bit PV guests
+enabling denial-of-service attacks or privilege escalation attacks.
 
 ### x86/HVM
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu May 06 12:33:44 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 06 May 2021 12:33:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.123458.232853 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ledCK-0000cd-0O; Thu, 06 May 2021 12:33:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 123458.232853; Thu, 06 May 2021 12:33:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ledCJ-0000cX-Tg; Thu, 06 May 2021 12:33:43 +0000
Received: by outflank-mailman (input) for mailman id 123458;
 Thu, 06 May 2021 12:33:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ledCI-0000cB-Hh
 for xen-changelog@lists.xenproject.org; Thu, 06 May 2021 12:33:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ledCI-0007zE-Gy
 for xen-changelog@lists.xenproject.org; Thu, 06 May 2021 12:33:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ledCI-0002nL-G1
 for xen-changelog@lists.xenproject.org; Thu, 06 May 2021 12:33:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=zDOMr0N7o19M1FhqhhN1wT5MJslCFrTdq6Eq7mg2ZYs=; b=C/Ffeh/VfyzHKgk6BkNEWTmEso
	Df38tT6lDaaCjPBUpTg6kW9600WUWbsHwtANOOVVY2X4efK9ILyOAa0TznoyO4SWdoI0DFjmedXCK
	k2cz2UekLuWml6S5MSgrEh67qqY5+GAcvf0eK88EMlfLapV25vC6SuSCNDXP3jKHCn50=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] libxl: don't ignore the return value from xc_cpuid_apply_policy
Message-Id: <E1ledCI-0002nL-G1@xenbits.xenproject.org>
Date: Thu, 06 May 2021 12:33:42 +0000

commit 34990446ca91d9e201ff17bd4e3f43bfe3ad308e
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Thu Mar 18 11:11:22 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue May 4 18:35:35 2021 +0100

    libxl: don't ignore the return value from xc_cpuid_apply_policy
    
    Also change libxl__cpuid_legacy to propagate the error from
    xc_cpuid_apply_policy into callers.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
---
 tools/libs/light/libxl_cpuid.c    | 15 +++++++++++----
 tools/libs/light/libxl_create.c   |  5 +++--
 tools/libs/light/libxl_dom.c      |  2 +-
 tools/libs/light/libxl_internal.h |  4 ++--
 tools/libs/light/libxl_nocpuid.c  |  5 +++--
 5 files changed, 20 insertions(+), 11 deletions(-)

diff --git a/tools/libs/light/libxl_cpuid.c b/tools/libs/light/libxl_cpuid.c
index f32c5d3a6f..eb6feaa96d 100644
--- a/tools/libs/light/libxl_cpuid.c
+++ b/tools/libs/light/libxl_cpuid.c
@@ -426,11 +426,13 @@ int libxl_cpuid_parse_config_xend(libxl_cpuid_policy_list *cpuid,
     return 0;
 }
 
-void libxl__cpuid_legacy(libxl_ctx *ctx, uint32_t domid, bool restore,
-                         libxl_domain_build_info *info)
+int libxl__cpuid_legacy(libxl_ctx *ctx, uint32_t domid, bool restore,
+                        libxl_domain_build_info *info)
 {
+    GC_INIT(ctx);
     bool pae = true;
     bool itsc;
+    int r;
 
     /*
      * Gross hack.  Using libxl_defbool_val() here causes libvirt to crash in
@@ -469,8 +471,13 @@ void libxl__cpuid_legacy(libxl_ctx *ctx, uint32_t domid, bool restore,
     itsc = (libxl_defbool_val(info->disable_migrate) ||
             info->tsc_mode == LIBXL_TSC_MODE_ALWAYS_EMULATE);
 
-    xc_cpuid_apply_policy(ctx->xch, domid, restore, NULL, 0,
-                          pae, itsc, nested_virt, info->cpuid);
+    r = xc_cpuid_apply_policy(ctx->xch, domid, restore, NULL, 0,
+                              pae, itsc, nested_virt, info->cpuid);
+    if (r)
+        LOGEVD(ERROR, -r, domid, "Failed to apply CPUID policy");
+
+    GC_FREE;
+    return r ? ERROR_FAIL : 0;
 }
 
 static const char *input_names[2] = { "leaf", "subleaf" };
diff --git a/tools/libs/light/libxl_create.c b/tools/libs/light/libxl_create.c
index 43e9ba9c63..e356b2106d 100644
--- a/tools/libs/light/libxl_create.c
+++ b/tools/libs/light/libxl_create.c
@@ -1434,6 +1434,7 @@ int libxl__srm_callout_callback_static_data_done(unsigned int missing,
 
     libxl_domain_config *d_config = dcs->guest_config;
     libxl_domain_build_info *info = &d_config->b_info;
+    int rc = 0;
 
     /*
      * CPUID/MSR information is not present in pre Xen-4.14 streams.
@@ -1443,9 +1444,9 @@ int libxl__srm_callout_callback_static_data_done(unsigned int missing,
      * stream doesn't contain any CPUID data.
      */
     if (missing & XGR_SDD_MISSING_CPUID)
-        libxl__cpuid_legacy(ctx, dcs->guest_domid, true, info);
+        rc = libxl__cpuid_legacy(ctx, dcs->guest_domid, true, info);
 
-    return 0;
+    return rc;
 }
 
 void libxl__srm_callout_callback_restore_results(xen_pfn_t store_mfn,
diff --git a/tools/libs/light/libxl_dom.c b/tools/libs/light/libxl_dom.c
index 842a51c86c..e9f58ee4b2 100644
--- a/tools/libs/light/libxl_dom.c
+++ b/tools/libs/light/libxl_dom.c
@@ -384,7 +384,7 @@ int libxl__build_pre(libxl__gc *gc, uint32_t domid,
      * being migrated-in/restored have CPUID handled during the
      * static_data_done() callback. */
     if (!state->restore)
-        libxl__cpuid_legacy(ctx, domid, false, info);
+        rc = libxl__cpuid_legacy(ctx, domid, false, info);
 
     return rc;
 }
diff --git a/tools/libs/light/libxl_internal.h b/tools/libs/light/libxl_internal.h
index c6a4a187f5..44a2f3c8fe 100644
--- a/tools/libs/light/libxl_internal.h
+++ b/tools/libs/light/libxl_internal.h
@@ -2052,8 +2052,8 @@ typedef yajl_gen_status (*libxl__gen_json_callback)(yajl_gen hand, void *);
 _hidden char *libxl__object_to_json(libxl_ctx *ctx, const char *type,
                                     libxl__gen_json_callback gen, void *p);
 
-_hidden void libxl__cpuid_legacy(libxl_ctx *ctx, uint32_t domid, bool retore,
-                                 libxl_domain_build_info *info);
+_hidden int libxl__cpuid_legacy(libxl_ctx *ctx, uint32_t domid, bool retore,
+                                libxl_domain_build_info *info);
 
 /* Calls poll() again - useful to check whether a signaled condition
  * is still true.  Cannot fail.  Returns currently-true revents. */
diff --git a/tools/libs/light/libxl_nocpuid.c b/tools/libs/light/libxl_nocpuid.c
index f47336565b..0630959e76 100644
--- a/tools/libs/light/libxl_nocpuid.c
+++ b/tools/libs/light/libxl_nocpuid.c
@@ -34,9 +34,10 @@ int libxl_cpuid_parse_config_xend(libxl_cpuid_policy_list *cpuid,
     return 0;
 }
 
-void libxl__cpuid_legacy(libxl_ctx *ctx, uint32_t domid, bool restore,
-                         libxl_domain_build_info *info)
+int libxl__cpuid_legacy(libxl_ctx *ctx, uint32_t domid, bool restore,
+                        libxl_domain_build_info *info)
 {
+    return 0;
 }
 
 yajl_gen_status libxl_cpuid_policy_list_gen_json(yajl_gen hand,
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu May 06 12:33:54 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 06 May 2021 12:33:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.123459.232857 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ledCU-0000fr-29; Thu, 06 May 2021 12:33:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 123459.232857; Thu, 06 May 2021 12:33:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ledCT-0000ff-VC; Thu, 06 May 2021 12:33:53 +0000
Received: by outflank-mailman (input) for mailman id 123459;
 Thu, 06 May 2021 12:33:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ledCS-0000fR-L1
 for xen-changelog@lists.xenproject.org; Thu, 06 May 2021 12:33:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ledCS-0007zO-KG
 for xen-changelog@lists.xenproject.org; Thu, 06 May 2021 12:33:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ledCS-0002o2-JD
 for xen-changelog@lists.xenproject.org; Thu, 06 May 2021 12:33:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=6dFD2hBKEXiGz0bCjUi6/a07jHLPFAF1nb1W17plaL0=; b=v+mJS3Q1wwfXu+d8zlBXoN20ka
	UgcYeYgZ1jfFczqn8zL6hWOdHb0r4o9Sp0ZtB/pJXnQAa1ZJSPs0HI0MXFOJil6Eo3cD0VKuFFN4d
	V/lGlCar7AfRUAaWxzLX3DjF8naiGy/o+n15hljcvXDO/Y54SYxDNzodI1DUHcdrdP8M=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] libs/guest: allow updating a cpu policy CPUID data
Message-Id: <E1ledCS-0002o2-JD@xenbits.xenproject.org>
Date: Thu, 06 May 2021 12:33:52 +0000

commit 2d09c97e58ea455242a3862c16e732592841ddde
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Wed Mar 17 16:49:55 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue May 4 18:35:53 2021 +0100

    libs/guest: allow updating a cpu policy CPUID data
    
    Introduce a helper to update the CPUID policy using an array of
    xen_cpuid_leaf_t entries. Note the leaves present in the input
    xen_cpuid_leaf_t array will replace any existing leaves on the policy.
    
    No user of the interface introduced on this patch.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/include/xenctrl.h         |  3 +++
 tools/libs/guest/xg_cpuid_x86.c | 20 ++++++++++++++++++++
 2 files changed, 23 insertions(+)

diff --git a/tools/include/xenctrl.h b/tools/include/xenctrl.h
index 27cec1b93f..543bd2a4c2 100644
--- a/tools/include/xenctrl.h
+++ b/tools/include/xenctrl.h
@@ -2608,6 +2608,9 @@ int xc_cpu_policy_set_domain(xc_interface *xch, uint32_t domid,
 int xc_cpu_policy_serialise(xc_interface *xch, const xc_cpu_policy_t policy,
                             xen_cpuid_leaf_t *leaves, uint32_t *nr_leaves,
                             xen_msr_entry_t *msrs, uint32_t *nr_msrs);
+int xc_cpu_policy_update_cpuid(xc_interface *xch, xc_cpu_policy_t policy,
+                               const xen_cpuid_leaf_t *leaves,
+                               uint32_t nr);
 
 int xc_get_cpu_levelling_caps(xc_interface *xch, uint32_t *caps);
 int xc_get_cpu_featureset(xc_interface *xch, uint32_t index,
diff --git a/tools/libs/guest/xg_cpuid_x86.c b/tools/libs/guest/xg_cpuid_x86.c
index 0c9b3a960f..713649edde 100644
--- a/tools/libs/guest/xg_cpuid_x86.c
+++ b/tools/libs/guest/xg_cpuid_x86.c
@@ -822,3 +822,23 @@ int xc_cpu_policy_serialise(xc_interface *xch, const xc_cpu_policy_t p,
     errno = 0;
     return 0;
 }
+
+int xc_cpu_policy_update_cpuid(xc_interface *xch, xc_cpu_policy_t policy,
+                               const xen_cpuid_leaf_t *leaves,
+                               uint32_t nr)
+{
+    unsigned int err_leaf = -1, err_subleaf = -1;
+    int rc = x86_cpuid_copy_from_buffer(&policy->cpuid, leaves, nr,
+                                        &err_leaf, &err_subleaf);
+
+    if ( rc )
+    {
+        if ( err_leaf != -1 )
+            ERROR("Failed to update CPUID (err leaf %#x, subleaf %#x) (%d = %s)",
+                  err_leaf, err_subleaf, -rc, strerror(-rc));
+        errno = -rc;
+        rc = -1;
+    }
+
+    return rc;
+}
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu May 06 12:34:04 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 06 May 2021 12:34:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.123460.232861 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ledCe-0000iw-44; Thu, 06 May 2021 12:34:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 123460.232861; Thu, 06 May 2021 12:34:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ledCe-0000im-0b; Thu, 06 May 2021 12:34:04 +0000
Received: by outflank-mailman (input) for mailman id 123460;
 Thu, 06 May 2021 12:34:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ledCc-0000iW-OV
 for xen-changelog@lists.xenproject.org; Thu, 06 May 2021 12:34:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ledCc-0007zs-Nf
 for xen-changelog@lists.xenproject.org; Thu, 06 May 2021 12:34:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ledCc-0002p1-Mg
 for xen-changelog@lists.xenproject.org; Thu, 06 May 2021 12:34:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=JqHQtWTyqMlyxZ/xTWY+tMRUxohzwO2uGi/Qg3oHd8Q=; b=wnIgntmKNWngRDU3xj2TWB+KOr
	OmlkVVYk/SXovgOKc0eV4h+OT6mcmjPMdTotPPgvRKlOkO7XXPD5QRkKJsCCK5Ql8kEQUif0FvA/D
	+XwsaaKbHat7NMAuPXG5/1dPY0uLTPzhoU7dgpxkkKJASnPvlUE/P4i8cty6f9PnWLT0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] libs/guest: allow updating a cpu policy MSR data
Message-Id: <E1ledCc-0002p1-Mg@xenbits.xenproject.org>
Date: Thu, 06 May 2021 12:34:02 +0000

commit 989cf2db33f0c65d118667410be6c6ce604741d7
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Wed Mar 17 16:59:37 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue May 4 18:36:17 2021 +0100

    libs/guest: allow updating a cpu policy MSR data
    
    Introduce a helper to update the MSR policy using an array of
    xen_msr_entry_t entries. Note the MSRs present in the input
    xen_msr_entry_t array will replace any existing entries on the
    policy.
    
    No user of the interface introduced on this patch.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/include/xenctrl.h         |  2 ++
 tools/libs/guest/xg_cpuid_x86.c | 18 ++++++++++++++++++
 2 files changed, 20 insertions(+)

diff --git a/tools/include/xenctrl.h b/tools/include/xenctrl.h
index 543bd2a4c2..0a9e5fbd21 100644
--- a/tools/include/xenctrl.h
+++ b/tools/include/xenctrl.h
@@ -2611,6 +2611,8 @@ int xc_cpu_policy_serialise(xc_interface *xch, const xc_cpu_policy_t policy,
 int xc_cpu_policy_update_cpuid(xc_interface *xch, xc_cpu_policy_t policy,
                                const xen_cpuid_leaf_t *leaves,
                                uint32_t nr);
+int xc_cpu_policy_update_msrs(xc_interface *xch, xc_cpu_policy_t policy,
+                              const xen_msr_entry_t *msrs, uint32_t nr);
 
 int xc_get_cpu_levelling_caps(xc_interface *xch, uint32_t *caps);
 int xc_get_cpu_featureset(xc_interface *xch, uint32_t index,
diff --git a/tools/libs/guest/xg_cpuid_x86.c b/tools/libs/guest/xg_cpuid_x86.c
index 713649edde..f14c5fead2 100644
--- a/tools/libs/guest/xg_cpuid_x86.c
+++ b/tools/libs/guest/xg_cpuid_x86.c
@@ -842,3 +842,21 @@ int xc_cpu_policy_update_cpuid(xc_interface *xch, xc_cpu_policy_t policy,
 
     return rc;
 }
+
+int xc_cpu_policy_update_msrs(xc_interface *xch, xc_cpu_policy_t policy,
+                              const xen_msr_entry_t *msrs, uint32_t nr)
+{
+    unsigned int err_msr = -1;
+    int rc = x86_msr_copy_from_buffer(&policy->msr, msrs, nr, &err_msr);
+
+    if ( rc )
+    {
+        if ( err_msr != -1 )
+            ERROR("Failed to deserialise MSRS (err index %#x) (%d = %s)",
+                  err_msr, -rc, strerror(-rc));
+        errno = -rc;
+        rc = -1;
+    }
+
+    return rc;
+}
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu May 06 12:34:14 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 06 May 2021 12:34:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.123461.232865 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ledCo-0000mI-70; Thu, 06 May 2021 12:34:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 123461.232865; Thu, 06 May 2021 12:34:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ledCo-0000mA-3o; Thu, 06 May 2021 12:34:14 +0000
Received: by outflank-mailman (input) for mailman id 123461;
 Thu, 06 May 2021 12:34:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ledCm-0000li-Rg
 for xen-changelog@lists.xenproject.org; Thu, 06 May 2021 12:34:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ledCm-00080I-Qv
 for xen-changelog@lists.xenproject.org; Thu, 06 May 2021 12:34:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ledCm-0002py-Q5
 for xen-changelog@lists.xenproject.org; Thu, 06 May 2021 12:34:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=yu1gJxc0sGIFiItoLNXKpli4yi0rtokd55I7JtO5qQM=; b=G1FiS/Psiq4ki3ieEYAiFUD+Za
	YRVFjFMb2WVI+9F4jcStwaWF/2HpGL6Lx0LABnw4RcDpg3Yeh8jQHtCnueDpUvmfWJ0jzJ9O9o6nt
	WrswQl4/ALoRFN2+4hlkwDupe4IRjPebjnfPegLEjBMq8jYC9Q4aNjjFTtlwXg+inppY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] libs/guest: introduce helper to check cpu policy compatibility
Message-Id: <E1ledCm-0002py-Q5@xenbits.xenproject.org>
Date: Thu, 06 May 2021 12:34:12 +0000

commit 398ff4725b7b4804a3b8f5ee376f3d95d4bd32cd
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Wed Mar 17 17:09:45 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue May 4 18:37:30 2021 +0100

    libs/guest: introduce helper to check cpu policy compatibility
    
    Such helpers is just a wrapper to the existing
    x86_cpu_policies_are_compatible function. This requires building
    policy.c from libx86 on user land also.
    
    No user of the interface introduced.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/include/xenctrl.h         |  4 ++++
 tools/libs/guest/Makefile       |  2 +-
 tools/libs/guest/xg_cpuid_x86.c | 19 +++++++++++++++++++
 3 files changed, 24 insertions(+), 1 deletion(-)

diff --git a/tools/include/xenctrl.h b/tools/include/xenctrl.h
index 0a9e5fbd21..0fdb2e8885 100644
--- a/tools/include/xenctrl.h
+++ b/tools/include/xenctrl.h
@@ -2614,6 +2614,10 @@ int xc_cpu_policy_update_cpuid(xc_interface *xch, xc_cpu_policy_t policy,
 int xc_cpu_policy_update_msrs(xc_interface *xch, xc_cpu_policy_t policy,
                               const xen_msr_entry_t *msrs, uint32_t nr);
 
+/* Compatibility calculations. */
+bool xc_cpu_policy_is_compatible(xc_interface *xch, const xc_cpu_policy_t host,
+                                 const xc_cpu_policy_t guest);
+
 int xc_get_cpu_levelling_caps(xc_interface *xch, uint32_t *caps);
 int xc_get_cpu_featureset(xc_interface *xch, uint32_t index,
                           uint32_t *nr_features, uint32_t *featureset);
diff --git a/tools/libs/guest/Makefile b/tools/libs/guest/Makefile
index 604e1695d6..6d2a1d5bbc 100644
--- a/tools/libs/guest/Makefile
+++ b/tools/libs/guest/Makefile
@@ -40,7 +40,7 @@ $(patsubst %.c,%.opic,$(ELF_SRCS-y)): CFLAGS += -Wno-pointer-sign
 ifeq ($(CONFIG_X86),y) # Add libx86 to the build
 vpath %.c ../../../xen/lib/x86
 
-SRCS-y                 += cpuid.c msr.c
+SRCS-y                 += cpuid.c msr.c policy.c
 endif
 
 # new domain builder
diff --git a/tools/libs/guest/xg_cpuid_x86.c b/tools/libs/guest/xg_cpuid_x86.c
index f14c5fead2..d4e02cecb1 100644
--- a/tools/libs/guest/xg_cpuid_x86.c
+++ b/tools/libs/guest/xg_cpuid_x86.c
@@ -860,3 +860,22 @@ int xc_cpu_policy_update_msrs(xc_interface *xch, xc_cpu_policy_t policy,
 
     return rc;
 }
+
+bool xc_cpu_policy_is_compatible(xc_interface *xch, const xc_cpu_policy_t host,
+                                 const xc_cpu_policy_t guest)
+{
+    struct cpu_policy_errors err = INIT_CPU_POLICY_ERRORS;
+    struct cpu_policy h = { &host->cpuid, &host->msr };
+    struct cpu_policy g = { &guest->cpuid, &guest->msr };
+    int rc = x86_cpu_policies_are_compatible(&h, &g, &err);
+
+    if ( !rc )
+        return true;
+
+    if ( err.leaf != -1 )
+        ERROR("Leaf %#x subleaf %#x is not compatible", err.leaf, err.subleaf);
+    if ( err.msr != -1 )
+        ERROR("MSR index %#x is not compatible", err.msr);
+
+    return false;
+}
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu May 06 12:34:24 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 06 May 2021 12:34:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.123462.232869 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ledCy-0000pS-8a; Thu, 06 May 2021 12:34:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 123462.232869; Thu, 06 May 2021 12:34:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ledCy-0000pK-5O; Thu, 06 May 2021 12:34:24 +0000
Received: by outflank-mailman (input) for mailman id 123462;
 Thu, 06 May 2021 12:34:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ledCw-0000os-Uk
 for xen-changelog@lists.xenproject.org; Thu, 06 May 2021 12:34:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ledCw-00080U-U1
 for xen-changelog@lists.xenproject.org; Thu, 06 May 2021 12:34:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ledCw-0002r4-T8
 for xen-changelog@lists.xenproject.org; Thu, 06 May 2021 12:34:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=eozllEuqXMEYVcyRKovr52Y1fO+yFJFK59I5jVheqQQ=; b=X54BShFZOs6qxxPR+PI3zJdtYv
	y52LUGmtZZEKp0yIUeJQ2/RFDVMy34RHqxRRXRFEvyI/UQoqMp3AXCs/6T5SE+gq+0vAIlU+cXAfC
	56sf8AqwSgXRPuqLZuePHidLruq4fSyZoSsCX9DZjigAuu6zzseqL1a+NiLbZyUrmwYs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xl: constify cmd_table entries
Message-Id: <E1ledCw-0002r4-T8@xenbits.xenproject.org>
Date: Thu, 06 May 2021 12:34:22 +0000

commit aaf61c4750d467176cd49323019cd286e35b8688
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Tue May 4 17:14:36 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue May 4 19:09:55 2021 +0100

    xl: constify cmd_table entries
    
    Also constify cmdtable_len and make use of ARRAY_SIZE, which is
    available in "xen-tools/libs.h".
    
    The entries in cmd_table don't need to be modified once xl is running.
    
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
---
 tools/xl/xl.c          | 4 ++--
 tools/xl/xl.h          | 6 +++---
 tools/xl/xl_cmdtable.c | 9 +++++----
 3 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/tools/xl/xl.c b/tools/xl/xl.c
index 3a89295802..4107d10fd4 100644
--- a/tools/xl/xl.c
+++ b/tools/xl/xl.c
@@ -362,7 +362,7 @@ int main(int argc, char **argv)
 {
     int opt = 0;
     char *cmd = 0;
-    struct cmd_spec *cspec;
+    const struct cmd_spec *cspec;
     int ret;
     void *config_data = 0;
     int config_len = 0;
@@ -462,7 +462,7 @@ int child_report(xlchildnum child)
 void help(const char *command)
 {
     int i;
-    struct cmd_spec *cmd;
+    const struct cmd_spec *cmd;
 
     if (!command || !strcmp(command, "help")) {
         printf("Usage xl [-vfNtT] <subcommand> [args]\n\n");
diff --git a/tools/xl/xl.h b/tools/xl/xl.h
index 137a29077c..e5a106dfbc 100644
--- a/tools/xl/xl.h
+++ b/tools/xl/xl.h
@@ -218,10 +218,10 @@ int main_qemu_monitor_command(int argc, char **argv);
 void help(const char *command);
 
 extern const char *common_domname;
-extern struct cmd_spec cmd_table[];
-extern int cmdtable_len;
+extern const struct cmd_spec cmd_table[];
+extern const int cmdtable_len;
 /* Look up a command in the table, allowing unambiguous truncation */
-struct cmd_spec *cmdtable_lookup(const char *s);
+const struct cmd_spec *cmdtable_lookup(const char *s);
 
 extern libxl_ctx *ctx;
 extern xentoollog_logger_stdiostream *logger;
diff --git a/tools/xl/xl_cmdtable.c b/tools/xl/xl_cmdtable.c
index 07f54daabe..661323d488 100644
--- a/tools/xl/xl_cmdtable.c
+++ b/tools/xl/xl_cmdtable.c
@@ -15,10 +15,11 @@
 #include <string.h>
 
 #include <libxl.h>
+#include <xen-tools/libs.h>
 
 #include "xl.h"
 
-struct cmd_spec cmd_table[] = {
+const struct cmd_spec cmd_table[] = {
     { "create",
       &main_create, 1, 1,
       "Create a domain from config file <filename>",
@@ -631,12 +632,12 @@ struct cmd_spec cmd_table[] = {
     },
 };
 
-int cmdtable_len = sizeof(cmd_table)/sizeof(struct cmd_spec);
+const int cmdtable_len = ARRAY_SIZE(cmd_table);
 
 /* Look up a command in the table, allowing unambiguous truncation */
-struct cmd_spec *cmdtable_lookup(const char *s)
+const struct cmd_spec *cmdtable_lookup(const char *s)
 {
-    struct cmd_spec *cmd = NULL;
+    const struct cmd_spec *cmd = NULL;
     size_t len;
     int i, count = 0;
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu May 06 12:34:34 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 06 May 2021 12:34:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.123463.232873 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ledD8-0000sK-9p; Thu, 06 May 2021 12:34:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 123463.232873; Thu, 06 May 2021 12:34:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ledD8-0000sC-6w; Thu, 06 May 2021 12:34:34 +0000
Received: by outflank-mailman (input) for mailman id 123463;
 Thu, 06 May 2021 12:34:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ledD7-0000ru-1R
 for xen-changelog@lists.xenproject.org; Thu, 06 May 2021 12:34:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ledD7-00080f-0d
 for xen-changelog@lists.xenproject.org; Thu, 06 May 2021 12:34:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ledD6-0002s0-WA
 for xen-changelog@lists.xenproject.org; Thu, 06 May 2021 12:34:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ovLdNnTRtb0IFUdlHit5nmrj3zkaefrkslxvamAWQXE=; b=HPgfHGmRTWNAExmp4hTdX9+jkS
	+UGrLvZs5PvY/VBRCLeTpvblcJwNPPemzPNiUXwmyTi2Hao+trsKs8iNO+2PiM6NgzbQE2KoY9/xd
	qCFH7r9rmdnyH6Ghlywg3GODW5QLm2YjkImo1VssJIvTg20uHwHvv4rry6CItEx/uB0Q=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools: handle missing xencommons in xenconsoled.service
Message-Id: <E1ledD6-0002s0-WA@xenbits.xenproject.org>
Date: Thu, 06 May 2021 12:34:32 +0000

commit 74a8d446f7dc1f18174f48597d7ebb04a634a120
Author:     Olaf Hering <olaf@aepfle.de>
AuthorDate: Tue May 4 15:58:54 2021 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue May 4 19:10:42 2021 +0100

    tools: handle missing xencommons in xenconsoled.service
    
    sysconfig files are not mandatory.
    Adjust xenconsoled.service to handle a missing sysconfig file by
    prepending a dash to the to-be-sourced filename.
    
    Signed-off-by: Olaf Hering <olaf@aepfle.de>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/hotplug/Linux/systemd/xenconsoled.service.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/hotplug/Linux/systemd/xenconsoled.service.in b/tools/hotplug/Linux/systemd/xenconsoled.service.in
index 8e333b114e..1f03de9041 100644
--- a/tools/hotplug/Linux/systemd/xenconsoled.service.in
+++ b/tools/hotplug/Linux/systemd/xenconsoled.service.in
@@ -9,7 +9,7 @@ Type=simple
 Environment=XENCONSOLED_ARGS=
 Environment=XENCONSOLED_TRACE=none
 Environment=XENCONSOLED_LOG_DIR=@XEN_LOG_DIR@/console
-EnvironmentFile=@CONFIG_DIR@/@CONFIG_LEAF_DIR@/xencommons
+EnvironmentFile=-@CONFIG_DIR@/@CONFIG_LEAF_DIR@/xencommons
 ExecStartPre=/bin/grep -q control_d /proc/xen/capabilities
 ExecStartPre=/bin/mkdir -p ${XENCONSOLED_LOG_DIR}
 ExecStart=@sbindir@/xenconsoled -i --log=${XENCONSOLED_TRACE} --log-dir=${XENCONSOLED_LOG_DIR} $XENCONSOLED_ARGS
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu May 06 12:34:44 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 06 May 2021 12:34:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.123464.232877 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ledDI-0000vm-BO; Thu, 06 May 2021 12:34:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 123464.232877; Thu, 06 May 2021 12:34:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ledDI-0000ve-8X; Thu, 06 May 2021 12:34:44 +0000
Received: by outflank-mailman (input) for mailman id 123464;
 Thu, 06 May 2021 12:34:43 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ledDH-0000vN-4D
 for xen-changelog@lists.xenproject.org; Thu, 06 May 2021 12:34:43 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ledDH-000810-3N
 for xen-changelog@lists.xenproject.org; Thu, 06 May 2021 12:34:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ledDH-0002tB-2i
 for xen-changelog@lists.xenproject.org; Thu, 06 May 2021 12:34:43 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=gR1SGFGkdND0N9YSGqsvc309osCc4I23bsNsoLqhB90=; b=VL5fnzF06VnCMk5Kj8jK3AwUWA
	Jd1HSNJqFqv5MzQtRUO1pVYHoat1ABPg3GEXiOHfFg0jDEWg3Z1NQpofq54n5j1KZwF0RdcjFGDM/
	P34qm309AsAcKTNTRUalVM3npUC0MEoV10O7zPt0OXdvL33BVJxvE2WXPfkzGL7xEs8E=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools: handle missing xencommons in xen-init-dom0.service
Message-Id: <E1ledDH-0002tB-2i@xenbits.xenproject.org>
Date: Thu, 06 May 2021 12:34:43 +0000

commit 27f32dbdb1b11d171f0fa4dfd3263b44e9f7c71c
Author:     Olaf Hering <olaf@aepfle.de>
AuthorDate: Tue May 4 16:31:28 2021 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue May 4 19:10:43 2021 +0100

    tools: handle missing xencommons in xen-init-dom0.service
    
    sysconfig files are not mandatory.
    Adjust xen-init-dom0.service to handle a missing sysconfig file by
    prepending a dash to the to-be-sourced filename.
    
    Signed-off-by: Olaf Hering <olaf@aepfle.de>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/hotplug/Linux/systemd/xen-init-dom0.service.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/hotplug/Linux/systemd/xen-init-dom0.service.in b/tools/hotplug/Linux/systemd/xen-init-dom0.service.in
index beed3126c6..98779b8507 100644
--- a/tools/hotplug/Linux/systemd/xen-init-dom0.service.in
+++ b/tools/hotplug/Linux/systemd/xen-init-dom0.service.in
@@ -7,7 +7,7 @@ ConditionPathExists=/proc/xen/capabilities
 [Service]
 Type=oneshot
 RemainAfterExit=true
-EnvironmentFile=@CONFIG_DIR@/@CONFIG_LEAF_DIR@/xencommons
+EnvironmentFile=-@CONFIG_DIR@/@CONFIG_LEAF_DIR@/xencommons
 ExecStartPre=/bin/grep -q control_d /proc/xen/capabilities
 ExecStart=@LIBEXEC_BIN@/xen-init-dom0 $XEN_DOM0_UUID
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu May 06 12:34:54 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 06 May 2021 12:34:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.123465.232881 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ledDS-0000ya-DQ; Thu, 06 May 2021 12:34:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 123465.232881; Thu, 06 May 2021 12:34:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ledDS-0000yQ-A7; Thu, 06 May 2021 12:34:54 +0000
Received: by outflank-mailman (input) for mailman id 123465;
 Thu, 06 May 2021 12:34:53 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ledDR-0000yA-79
 for xen-changelog@lists.xenproject.org; Thu, 06 May 2021 12:34:53 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ledDR-00081B-6M
 for xen-changelog@lists.xenproject.org; Thu, 06 May 2021 12:34:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ledDR-0002uR-5d
 for xen-changelog@lists.xenproject.org; Thu, 06 May 2021 12:34:53 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=yH06QlBL0nV6qwhSYbE640drJzec9sd2j80cG3r3bTA=; b=Iam1zcw0VBdU4PWzwTkxCPM9hU
	gU+aVqD9PwjaafQt58V0vZjfUzYD72plQW8O7apTboMy6/5jnEYCLH1zyUBMBdty0wyXzU7BHGvP7
	em2Q3tXyGpW1/WVQJkwZyaEL7KXubs0gKt38Mp31nhTH74blM0MmhVCL0fcbTuCMvjOU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/xstate: Elide redundant writes in set_xcr0()
Message-Id: <E1ledDR-0002uR-5d@xenbits.xenproject.org>
Date: Thu, 06 May 2021 12:34:53 +0000

commit 9478ee4a1501c8899307eaa24585f8c6f8d23fa9
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Apr 30 20:17:55 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue May 4 19:12:47 2021 +0100

    x86/xstate: Elide redundant writes in set_xcr0()
    
    XSETBV is an expensive instruction as, amongst other things, it involves
    reconfiguring the instruction decode at the frontend of the pipeline.
    
    We have several paths which reconfigure %xcr0 in quick succession (the context
    switch path has 5, including the fpu save/restore helpers), and only a single
    caller takes any care to try to skip redundant writes.
    
    Update set_xcr0() to perform amortisation automatically, and simplify the
    __context_switch() path as a consequence.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/domain.c |  4 +---
 xen/arch/x86/xstate.c | 15 +++++++++++----
 2 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index 4dc27f798e..50a27197b5 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -1977,9 +1977,7 @@ static void __context_switch(void)
         memcpy(stack_regs, &n->arch.user_regs, CTXT_SWITCH_STACK_BYTES);
         if ( cpu_has_xsave )
         {
-            u64 xcr0 = n->arch.xcr0 ?: XSTATE_FP_SSE;
-
-            if ( xcr0 != get_xcr0() && !set_xcr0(xcr0) )
+            if ( !set_xcr0(n->arch.xcr0 ?: XSTATE_FP_SSE) )
                 BUG();
 
             if ( cpu_has_xsaves && is_hvm_vcpu(n) )
diff --git a/xen/arch/x86/xstate.c b/xen/arch/x86/xstate.c
index d49413b745..65c720a26a 100644
--- a/xen/arch/x86/xstate.c
+++ b/xen/arch/x86/xstate.c
@@ -55,11 +55,18 @@ static inline bool xsetbv(u32 index, u64 xfeatures)
     return lo != 0;
 }
 
-bool set_xcr0(u64 xfeatures)
+bool set_xcr0(u64 val)
 {
-    if ( !xsetbv(XCR_XFEATURE_ENABLED_MASK, xfeatures) )
-        return false;
-    this_cpu(xcr0) = xfeatures;
+    uint64_t *this_xcr0 = &this_cpu(xcr0);
+
+    if ( *this_xcr0 != val )
+    {
+        if ( !xsetbv(XCR_XFEATURE_ENABLED_MASK, val) )
+            return false;
+
+        *this_xcr0 = val;
+    }
+
     return true;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu May 06 12:35:04 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 06 May 2021 12:35:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.123466.232885 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ledDc-000118-EX; Thu, 06 May 2021 12:35:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 123466.232885; Thu, 06 May 2021 12:35:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ledDc-000110-Bc; Thu, 06 May 2021 12:35:04 +0000
Received: by outflank-mailman (input) for mailman id 123466;
 Thu, 06 May 2021 12:35:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ledDb-00010o-A9
 for xen-changelog@lists.xenproject.org; Thu, 06 May 2021 12:35:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ledDb-00081a-9P
 for xen-changelog@lists.xenproject.org; Thu, 06 May 2021 12:35:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ledDb-0002vq-8e
 for xen-changelog@lists.xenproject.org; Thu, 06 May 2021 12:35:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=yZjyRa+wW3ePkfLEDsCYqL8Me2cL/a3SQ2dGA6ND9kc=; b=M6nFg1MoyGKXEzVrALDBH6fUIZ
	oM0OefVFjmz1PtO3euvmBtKZYdrj2M4eHB1lQD1GZTbhcyWeA+rJGnb0MLCXUEGkWP7dyGC8baF7U
	Ipvj+ArAGE/2VfEEVzoysLcVrT7kXMqLYxpuGYlv78rg7KpH18vGf87xLB8P0YVmQk6Y=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/xstate: Rename _xstate_ctxt_size() to hw_uncompressed_size()
Message-Id: <E1ledDb-0002vq-8e@xenbits.xenproject.org>
Date: Thu, 06 May 2021 12:35:03 +0000

commit 8cccd6438e86112ab383e41b433b5a7e73be9621
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Apr 30 20:17:55 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue May 4 19:14:23 2021 +0100

    x86/xstate: Rename _xstate_ctxt_size() to hw_uncompressed_size()
    
    The latter is a more descriptive name, as it explicitly highlights the query
    from hardware.
    
    Simplify the internal logic using cpuid_count_ebx(), and drop the curr/max
    assertion as this property is guaranteed by the x86 ISA.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/xstate.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/xen/arch/x86/xstate.c b/xen/arch/x86/xstate.c
index 65c720a26a..6aaf9a2f15 100644
--- a/xen/arch/x86/xstate.c
+++ b/xen/arch/x86/xstate.c
@@ -554,19 +554,18 @@ void xstate_free_save_area(struct vcpu *v)
     v->arch.xsave_area = NULL;
 }
 
-static unsigned int _xstate_ctxt_size(u64 xcr0)
+static unsigned int hw_uncompressed_size(uint64_t xcr0)
 {
     u64 act_xcr0 = get_xcr0();
-    u32 eax, ebx = 0, ecx, edx;
+    unsigned int size;
     bool ok = set_xcr0(xcr0);
 
     ASSERT(ok);
-    cpuid_count(XSTATE_CPUID, 0, &eax, &ebx, &ecx, &edx);
-    ASSERT(ebx <= ecx);
+    size = cpuid_count_ebx(XSTATE_CPUID, 0);
     ok = set_xcr0(act_xcr0);
     ASSERT(ok);
 
-    return ebx;
+    return size;
 }
 
 /* Fastpath for common xstate size requests, avoiding reloads of xcr0. */
@@ -578,7 +577,7 @@ unsigned int xstate_ctxt_size(u64 xcr0)
     if ( xcr0 == 0 )
         return 0;
 
-    return _xstate_ctxt_size(xcr0);
+    return hw_uncompressed_size(xcr0);
 }
 
 static bool valid_xcr0(uint64_t xcr0)
@@ -662,14 +661,14 @@ void xstate_init(struct cpuinfo_x86 *c)
          * xsave_cntxt_size is the max size required by enabled features.
          * We know FP/SSE and YMM about eax, and nothing about edx at present.
          */
-        xsave_cntxt_size = _xstate_ctxt_size(feature_mask);
+        xsave_cntxt_size = hw_uncompressed_size(feature_mask);
         printk("xstate: size: %#x and states: %#"PRIx64"\n",
                xsave_cntxt_size, xfeature_mask);
     }
     else
     {
         BUG_ON(xfeature_mask != feature_mask);
-        BUG_ON(xsave_cntxt_size != _xstate_ctxt_size(feature_mask));
+        BUG_ON(xsave_cntxt_size != hw_uncompressed_size(feature_mask));
     }
 
     if ( setup_xstate_features(bsp) && bsp )
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu May 06 23:55:11 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 06 May 2021 23:55:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.123733.233426 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lenpg-00020A-J2; Thu, 06 May 2021 23:55:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 123733.233426; Thu, 06 May 2021 23:55:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lenpg-000202-G1; Thu, 06 May 2021 23:55:04 +0000
Received: by outflank-mailman (input) for mailman id 123733;
 Thu, 06 May 2021 23:55:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lenpe-0001zw-F5
 for xen-changelog@lists.xenproject.org; Thu, 06 May 2021 23:55:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lenpe-0003pP-EB
 for xen-changelog@lists.xenproject.org; Thu, 06 May 2021 23:55:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lenpe-0006d1-Cs
 for xen-changelog@lists.xenproject.org; Thu, 06 May 2021 23:55:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ZCh1V0SHLcd1smTHZzLp77TEG/BLqNiVh1C0aBGsj7w=; b=hi8uiWpPbvE4p/7YEM5mYuVAz7
	E/sKi75wQzeqNEHBH6Ll64Jv8ntMXZ43IRk6YiLyLQ2Jfnq1oMECl6dY3kawShUxKoJu4uwm3hkcw
	E038jvVYrEsDcQc7GAdktDUJVr9AcDJaBrcDjFqDwu54a8rz1vIfTxMuLyrgLyPNxT0Y=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation: save xen config before building
Message-Id: <E1lenpe-0006d1-Cs@xenbits.xenproject.org>
Date: Thu, 06 May 2021 23:55:02 +0000

commit b066bd195c04f15ca396ce427c03da1e14849197
Author:     Wei Liu <wl@xen.org>
AuthorDate: Wed May 5 11:45:16 2021 +0000
Commit:     Wei Liu <wl@xen.org>
CommitDate: Wed May 5 14:23:01 2021 +0000

    automation: save xen config before building
    
    It is reported that failed randconfig runs are missing the config file
    which makes debugging impossible. Fix this by moving the line that
    copies the config file before the build is executed.
    
    Signed-off-by: Wei Liu <wl@xen.org>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 automation/scripts/build | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/automation/scripts/build b/automation/scripts/build
index eaf70b11d1..46b6903d29 100755
--- a/automation/scripts/build
+++ b/automation/scripts/build
@@ -16,6 +16,10 @@ else
     make -j$(nproc) -C xen defconfig
 fi
 
+# Save the config file before building because build failure causes the script
+# to exit early -- bash is invoked with -e.
+cp xen/.config xen-config
+
 # arm32 only cross-compiles the hypervisor
 if [[ "${XEN_TARGET_ARCH}" = "arm32" ]]; then
     hypervisor_only="y"
@@ -59,7 +63,6 @@ else
 fi
 
 # Extract artifacts to avoid getting rewritten by customised builds
-cp xen/.config xen-config
 mkdir binaries
 if [[ "${XEN_TARGET_ARCH}" != "x86_32" ]]; then
     cp xen/xen binaries/xen
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu May 06 23:55:14 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 06 May 2021 23:55:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.123734.233431 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lenpq-00022D-LL; Thu, 06 May 2021 23:55:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 123734.233431; Thu, 06 May 2021 23:55:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lenpq-000225-HV; Thu, 06 May 2021 23:55:14 +0000
Received: by outflank-mailman (input) for mailman id 123734;
 Thu, 06 May 2021 23:55:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lenpo-00021x-IV
 for xen-changelog@lists.xenproject.org; Thu, 06 May 2021 23:55:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lenpo-0003pT-Ha
 for xen-changelog@lists.xenproject.org; Thu, 06 May 2021 23:55:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lenpo-0006dY-Gg
 for xen-changelog@lists.xenproject.org; Thu, 06 May 2021 23:55:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=AyZFLuyyL7KmTqXeZVfB0kcPSMX1GCVANc70kfh5lEA=; b=ePhgifXb/iFMfhUyM14pU3w+qm
	fyRZdWwHb3fsF/AThpcZd0DUhw7SPreqy1sX3BKUkeNu7K+EclqziWzAWJlAx6DVGka2rD/rh11RJ
	fW2VMVp5bXG2qOGHrPl4DW6GXHWl87NwdjxvFH7ucjHHWeavEAHwPfI2sMqjz2ZQxNt0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/xl: Use const whenever we point to literal strings
Message-Id: <E1lenpo-0006dY-Gg@xenbits.xenproject.org>
Date: Thu, 06 May 2021 23:55:12 +0000

commit e921931feccc8406d5a968e3f97827095b02ce96
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Wed May 5 18:43:06 2021 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Wed May 5 18:43:06 2021 +0100

    tools/xl: Use const whenever we point to literal strings
    
    literal strings are not meant to be modified. So we should use const
    char * rather than char * when we want to store a pointer to them.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
---
 tools/xl/xl.h         | 8 ++++----
 tools/xl/xl_console.c | 2 +-
 tools/xl/xl_utils.c   | 4 ++--
 tools/xl/xl_utils.h   | 4 ++--
 4 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/tools/xl/xl.h b/tools/xl/xl.h
index e5a106dfbc..7e23f30192 100644
--- a/tools/xl/xl.h
+++ b/tools/xl/xl.h
@@ -21,13 +21,13 @@
 #include <xentoollog.h>
 
 struct cmd_spec {
-    char *cmd_name;
+    const char *cmd_name;
     int (*cmd_impl)(int argc, char **argv);
     int can_dryrun;
     int modifies;
-    char *cmd_desc;
-    char *cmd_usage;
-    char *cmd_option;
+    const char *cmd_desc;
+    const char *cmd_usage;
+    const char *cmd_option;
 };
 
 struct domain_create {
diff --git a/tools/xl/xl_console.c b/tools/xl/xl_console.c
index 4e65d73867..b27f9e0136 100644
--- a/tools/xl/xl_console.c
+++ b/tools/xl/xl_console.c
@@ -27,7 +27,7 @@ int main_console(int argc, char **argv)
     uint32_t domid;
     int opt = 0, num = 0;
     libxl_console_type type = 0;
-    char *console_names = "pv, serial, vuart";
+    const char *console_names = "pv, serial, vuart";
 
     SWITCH_FOREACH_OPT(opt, "n:t:", NULL, "console", 1) {
     case 't':
diff --git a/tools/xl/xl_utils.c b/tools/xl/xl_utils.c
index 4503ac7ea0..17489d1829 100644
--- a/tools/xl/xl_utils.c
+++ b/tools/xl/xl_utils.c
@@ -27,7 +27,7 @@
 #include "xl.h"
 #include "xl_utils.h"
 
-void dolog(const char *file, int line, const char *func, char *fmt, ...)
+void dolog(const char *file, int line, const char *func, const char *fmt, ...)
 {
     va_list ap;
     char *s = NULL;
@@ -248,7 +248,7 @@ void print_bitmap(uint8_t *map, int maplen, FILE *stream)
     }
 }
 
-int do_daemonize(char *name, const char *pidfile)
+int do_daemonize(const char *name, const char *pidfile)
 {
     char *fullname;
     pid_t child1;
diff --git a/tools/xl/xl_utils.h b/tools/xl/xl_utils.h
index d98b419f10..0c337ede95 100644
--- a/tools/xl/xl_utils.h
+++ b/tools/xl/xl_utils.h
@@ -123,7 +123,7 @@ int def_getopt(int argc, char * const argv[],
                const struct option *longopts,
                const char* helpstr, int reqargs);
 
-void dolog(const char *file, int line, const char *func, char *fmt, ...)
+void dolog(const char *file, int line, const char *func, const char *fmt, ...)
 	__attribute__((format(printf,4,5)));
 
 void xvasprintf(char **strp, const char *fmt, va_list ap)
@@ -143,7 +143,7 @@ uint32_t find_domain(const char *p) __attribute__((warn_unused_result));
 
 void print_bitmap(uint8_t *map, int maplen, FILE *stream);
 
-int do_daemonize(char *name, const char *pidfile);
+int do_daemonize(const char *name, const char *pidfile);
 #endif /* XL_UTILS_H */
 
 /*
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu May 06 23:55:23 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 06 May 2021 23:55:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.123735.233434 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lenpz-00026V-O7; Thu, 06 May 2021 23:55:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 123735.233434; Thu, 06 May 2021 23:55:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lenpz-00026N-LC; Thu, 06 May 2021 23:55:23 +0000
Received: by outflank-mailman (input) for mailman id 123735;
 Thu, 06 May 2021 23:55:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lenpy-000265-Lw
 for xen-changelog@lists.xenproject.org; Thu, 06 May 2021 23:55:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lenpy-0003pu-L2
 for xen-changelog@lists.xenproject.org; Thu, 06 May 2021 23:55:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lenpy-0006e3-K3
 for xen-changelog@lists.xenproject.org; Thu, 06 May 2021 23:55:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=4aYD7q6tIJT9I33xYV1P/jrwLJkyeO4DvKl0za6OhdM=; b=BA1fGu2VP6qS4F3zTHKQki0HYC
	44/NRxlUMkIPvUouDXX4s/fGPs0pFR10Wu0psTKapU7VXZpFsH+csfoQ2yyPDm64Nm83OG0BHwIU3
	1OvhvXkjuETNl+Muw0opDnZCAdAIT7TcNW+PLURDpSt9PBQCpF9QKMEHChAPaY5OVZoE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] libs/guest: Don't hide the indirection on xc_cpu_policy_t
Message-Id: <E1lenpy-0006e3-K3@xenbits.xenproject.org>
Date: Thu, 06 May 2021 23:55:22 +0000

commit e19b01c186e061e23fac80ff7cbf83e622f384fe
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue May 4 19:40:47 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed May 5 20:20:42 2021 +0100

    libs/guest: Don't hide the indirection on xc_cpu_policy_t
    
    It is bad form in C, perhaps best demonstrated by trying to read
    xc_cpu_policy_destroy(), and causes const qualification to have
    less-than-obvious behaviour (the hidden pointer becomes const, not the thing
    it points at).
    
    xc_cpu_policy_set_domain() needs to drop its (now normal) const qualification,
    as the policy object is modified by the serialisation operation.
    
    This also shows up a problem with the x86_cpu_policies_are_compatible(), where
    the intermediate pointers are non-const.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 tools/include/xenctrl.h             | 22 +++++++++++-----------
 tools/libs/guest/xg_cpuid_x86.c     | 22 +++++++++++-----------
 tools/libs/guest/xg_sr_common_x86.c |  2 +-
 tools/misc/xen-cpuid.c              |  2 +-
 4 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/tools/include/xenctrl.h b/tools/include/xenctrl.h
index 0fdb2e8885..58d3377d6a 100644
--- a/tools/include/xenctrl.h
+++ b/tools/include/xenctrl.h
@@ -2590,33 +2590,33 @@ int xc_psr_get_domain_data(xc_interface *xch, uint32_t domid,
 int xc_psr_get_hw_info(xc_interface *xch, uint32_t socket,
                        xc_psr_feat_type type, xc_psr_hw_info *hw_info);
 
-typedef struct xc_cpu_policy *xc_cpu_policy_t;
+typedef struct xc_cpu_policy xc_cpu_policy_t;
 
 /* Create and free a xc_cpu_policy object. */
-xc_cpu_policy_t xc_cpu_policy_init(void);
-void xc_cpu_policy_destroy(xc_cpu_policy_t policy);
+xc_cpu_policy_t *xc_cpu_policy_init(void);
+void xc_cpu_policy_destroy(xc_cpu_policy_t *policy);
 
 /* Retrieve a system policy, or get/set a domains policy. */
 int xc_cpu_policy_get_system(xc_interface *xch, unsigned int policy_idx,
-                             xc_cpu_policy_t policy);
+                             xc_cpu_policy_t *policy);
 int xc_cpu_policy_get_domain(xc_interface *xch, uint32_t domid,
-                             xc_cpu_policy_t policy);
+                             xc_cpu_policy_t *policy);
 int xc_cpu_policy_set_domain(xc_interface *xch, uint32_t domid,
-                             const xc_cpu_policy_t policy);
+                             xc_cpu_policy_t *policy);
 
 /* Manipulate a policy via architectural representations. */
-int xc_cpu_policy_serialise(xc_interface *xch, const xc_cpu_policy_t policy,
+int xc_cpu_policy_serialise(xc_interface *xch, const xc_cpu_policy_t *policy,
                             xen_cpuid_leaf_t *leaves, uint32_t *nr_leaves,
                             xen_msr_entry_t *msrs, uint32_t *nr_msrs);
-int xc_cpu_policy_update_cpuid(xc_interface *xch, xc_cpu_policy_t policy,
+int xc_cpu_policy_update_cpuid(xc_interface *xch, xc_cpu_policy_t *policy,
                                const xen_cpuid_leaf_t *leaves,
                                uint32_t nr);
-int xc_cpu_policy_update_msrs(xc_interface *xch, xc_cpu_policy_t policy,
+int xc_cpu_policy_update_msrs(xc_interface *xch, xc_cpu_policy_t *policy,
                               const xen_msr_entry_t *msrs, uint32_t nr);
 
 /* Compatibility calculations. */
-bool xc_cpu_policy_is_compatible(xc_interface *xch, const xc_cpu_policy_t host,
-                                 const xc_cpu_policy_t guest);
+bool xc_cpu_policy_is_compatible(xc_interface *xch, xc_cpu_policy_t *host,
+                                 xc_cpu_policy_t *guest);
 
 int xc_get_cpu_levelling_caps(xc_interface *xch, uint32_t *caps);
 int xc_get_cpu_featureset(xc_interface *xch, uint32_t index,
diff --git a/tools/libs/guest/xg_cpuid_x86.c b/tools/libs/guest/xg_cpuid_x86.c
index d4e02cecb1..1ebc108213 100644
--- a/tools/libs/guest/xg_cpuid_x86.c
+++ b/tools/libs/guest/xg_cpuid_x86.c
@@ -672,18 +672,18 @@ out:
     return rc;
 }
 
-xc_cpu_policy_t xc_cpu_policy_init(void)
+xc_cpu_policy_t *xc_cpu_policy_init(void)
 {
     return calloc(1, sizeof(struct xc_cpu_policy));
 }
 
-void xc_cpu_policy_destroy(xc_cpu_policy_t policy)
+void xc_cpu_policy_destroy(xc_cpu_policy_t *policy)
 {
     if ( policy )
         free(policy);
 }
 
-static int deserialize_policy(xc_interface *xch, xc_cpu_policy_t policy,
+static int deserialize_policy(xc_interface *xch, xc_cpu_policy_t *policy,
                               unsigned int nr_leaves, unsigned int nr_entries)
 {
     uint32_t err_leaf = -1, err_subleaf = -1, err_msr = -1;
@@ -713,7 +713,7 @@ static int deserialize_policy(xc_interface *xch, xc_cpu_policy_t policy,
 }
 
 int xc_cpu_policy_get_system(xc_interface *xch, unsigned int policy_idx,
-                             xc_cpu_policy_t policy)
+                             xc_cpu_policy_t *policy)
 {
     unsigned int nr_leaves = ARRAY_SIZE(policy->leaves);
     unsigned int nr_entries = ARRAY_SIZE(policy->entries);
@@ -738,7 +738,7 @@ int xc_cpu_policy_get_system(xc_interface *xch, unsigned int policy_idx,
 }
 
 int xc_cpu_policy_get_domain(xc_interface *xch, uint32_t domid,
-                             xc_cpu_policy_t policy)
+                             xc_cpu_policy_t *policy)
 {
     unsigned int nr_leaves = ARRAY_SIZE(policy->leaves);
     unsigned int nr_entries = ARRAY_SIZE(policy->entries);
@@ -763,7 +763,7 @@ int xc_cpu_policy_get_domain(xc_interface *xch, uint32_t domid,
 }
 
 int xc_cpu_policy_set_domain(xc_interface *xch, uint32_t domid,
-                             const xc_cpu_policy_t policy)
+                             xc_cpu_policy_t *policy)
 {
     uint32_t err_leaf = -1, err_subleaf = -1, err_msr = -1;
     unsigned int nr_leaves = ARRAY_SIZE(policy->leaves);
@@ -791,7 +791,7 @@ int xc_cpu_policy_set_domain(xc_interface *xch, uint32_t domid,
     return rc;
 }
 
-int xc_cpu_policy_serialise(xc_interface *xch, const xc_cpu_policy_t p,
+int xc_cpu_policy_serialise(xc_interface *xch, const xc_cpu_policy_t *p,
                             xen_cpuid_leaf_t *leaves, uint32_t *nr_leaves,
                             xen_msr_entry_t *msrs, uint32_t *nr_msrs)
 {
@@ -823,7 +823,7 @@ int xc_cpu_policy_serialise(xc_interface *xch, const xc_cpu_policy_t p,
     return 0;
 }
 
-int xc_cpu_policy_update_cpuid(xc_interface *xch, xc_cpu_policy_t policy,
+int xc_cpu_policy_update_cpuid(xc_interface *xch, xc_cpu_policy_t *policy,
                                const xen_cpuid_leaf_t *leaves,
                                uint32_t nr)
 {
@@ -843,7 +843,7 @@ int xc_cpu_policy_update_cpuid(xc_interface *xch, xc_cpu_policy_t policy,
     return rc;
 }
 
-int xc_cpu_policy_update_msrs(xc_interface *xch, xc_cpu_policy_t policy,
+int xc_cpu_policy_update_msrs(xc_interface *xch, xc_cpu_policy_t *policy,
                               const xen_msr_entry_t *msrs, uint32_t nr)
 {
     unsigned int err_msr = -1;
@@ -861,8 +861,8 @@ int xc_cpu_policy_update_msrs(xc_interface *xch, xc_cpu_policy_t policy,
     return rc;
 }
 
-bool xc_cpu_policy_is_compatible(xc_interface *xch, const xc_cpu_policy_t host,
-                                 const xc_cpu_policy_t guest)
+bool xc_cpu_policy_is_compatible(xc_interface *xch, xc_cpu_policy_t *host,
+                                 xc_cpu_policy_t *guest)
 {
     struct cpu_policy_errors err = INIT_CPU_POLICY_ERRORS;
     struct cpu_policy h = { &host->cpuid, &host->msr };
diff --git a/tools/libs/guest/xg_sr_common_x86.c b/tools/libs/guest/xg_sr_common_x86.c
index 15265e7a33..563b4f0168 100644
--- a/tools/libs/guest/xg_sr_common_x86.c
+++ b/tools/libs/guest/xg_sr_common_x86.c
@@ -48,7 +48,7 @@ int write_x86_cpu_policy_records(struct xc_sr_context *ctx)
     struct xc_sr_record cpuid = { .type = REC_TYPE_X86_CPUID_POLICY, };
     struct xc_sr_record msrs  = { .type = REC_TYPE_X86_MSR_POLICY, };
     uint32_t nr_leaves = 0, nr_msrs = 0;
-    xc_cpu_policy_t policy = NULL;
+    xc_cpu_policy_t *policy = NULL;
     int rc;
 
     if ( xc_cpu_policy_get_size(xch, &nr_leaves, &nr_msrs) < 0 )
diff --git a/tools/misc/xen-cpuid.c b/tools/misc/xen-cpuid.c
index b2a36deacc..d4bc83d8c9 100644
--- a/tools/misc/xen-cpuid.c
+++ b/tools/misc/xen-cpuid.c
@@ -468,7 +468,7 @@ int main(int argc, char **argv)
         uint32_t i, max_leaves, max_msrs;
 
         xc_interface *xch = xc_interface_open(0, 0, 0);
-        xc_cpu_policy_t policy = xc_cpu_policy_init();
+        xc_cpu_policy_t *policy = xc_cpu_policy_init();
 
         if ( !xch )
             err(1, "xc_interface_open");
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu May 06 23:55:33 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 06 May 2021 23:55:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.123736.233438 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lenq9-0002An-Pa; Thu, 06 May 2021 23:55:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 123736.233438; Thu, 06 May 2021 23:55:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lenq9-0002Ag-Mi; Thu, 06 May 2021 23:55:33 +0000
Received: by outflank-mailman (input) for mailman id 123736;
 Thu, 06 May 2021 23:55:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lenq8-0002AO-Oy
 for xen-changelog@lists.xenproject.org; Thu, 06 May 2021 23:55:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lenq8-0003q8-OC
 for xen-changelog@lists.xenproject.org; Thu, 06 May 2021 23:55:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lenq8-0006ek-NK
 for xen-changelog@lists.xenproject.org; Thu, 06 May 2021 23:55:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ZbaX1IXCcXkNio52HNiI+fq41M48ZwhkwYqfjWXFD7o=; b=ORhQC8uHbjXywA6uqml18uMTNT
	K8m3IJFDZGPQNCfSUrzhHqhIRT9mY9sHIXdV8NySUTGOKi2OgUu1E/AJJ9Eu9zH5PWVY3GDqnz9F9
	4j1gzWOUpAbsksL6xRolo12z9LTNcoy+mK786K767LBzEE3Et2GI4gA/qVoGIIbZ9ZDM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/p2m: please Clang after making certain parts HVM-only
Message-Id: <E1lenq8-0006ek-NK@xenbits.xenproject.org>
Date: Thu, 06 May 2021 23:55:32 +0000

commit 09fc903c5ac042e2e1eb54e58ea7f207ed12ee16
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed May 5 09:07:30 2021 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed May 5 20:20:42 2021 +0100

    x86/p2m: please Clang after making certain parts HVM-only
    
    Move a few #ifdef-s, to account for diagnostics like
    
    p2m.c:549:1: error: non-void function does not return a value in all control paths [-Werror,-Wreturn-type]
    
    which appear despite paging_mode_translate() resolving to constant
    "false" when !HVM. All of the affected functions are intended to become
    fully HVM-only anyway, with their non-translated stub handling split off
    elsewhere.
    
    Fixes: 8d012d3ddffc ("x86/p2m: {get,set}_entry hooks and p2m-pt.c are HVM-only")
    Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/mm/p2m.c | 26 ++++++++++++++------------
 1 file changed, 14 insertions(+), 12 deletions(-)

diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
index 8f4816c414..dbb1cbeb59 100644
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -497,21 +497,23 @@ mfn_t __get_gfn_type_access(struct p2m_domain *p2m, unsigned long gfn_l,
 #ifdef CONFIG_HVM
     mfn_t mfn;
     gfn_t gfn = _gfn(gfn_l);
-#endif
-
-    /* Unshare makes no sense withuot populate. */
-    if ( q & P2M_UNSHARE )
-        q |= P2M_ALLOC;
 
     if ( !p2m || !paging_mode_translate(p2m->domain) )
     {
-        /* Not necessarily true, but for non-translated guests, we claim
-         * it's the most generic kind of memory */
+#endif
+        /*
+         * Not necessarily true, but for non-translated guests we claim
+         * it's the most generic kind of memory.
+         */
         *t = p2m_ram_rw;
         return _mfn(gfn_l);
+#ifdef CONFIG_HVM
     }
 
-#ifdef CONFIG_HVM
+    /* Unshare makes no sense without populate. */
+    if ( q & P2M_UNSHARE )
+        q |= P2M_ALLOC;
+
     if ( locked )
         /* Grab the lock here, don't release until put_gfn */
         gfn_lock(p2m, gfn, 0);
@@ -1417,18 +1419,18 @@ int set_identity_p2m_entry(struct domain *d, unsigned long gfn_l,
     mfn_t mfn;
     struct p2m_domain *p2m = p2m_get_hostp2m(d);
     int ret;
-#endif
 
     if ( !paging_mode_translate(d) )
     {
+#endif
         if ( !is_iommu_enabled(d) )
             return 0;
         return iommu_legacy_map(d, _dfn(gfn_l), _mfn(gfn_l),
                                 1ul << PAGE_ORDER_4K,
                                 IOMMUF_readable | IOMMUF_writable);
+#ifdef CONFIG_HVM
     }
 
-#ifdef CONFIG_HVM
     gfn_lock(p2m, gfn, 0);
 
     mfn = p2m->get_entry(p2m, gfn, &p2mt, &a, 0, NULL, NULL);
@@ -1464,16 +1466,16 @@ int clear_identity_p2m_entry(struct domain *d, unsigned long gfn_l)
     mfn_t mfn;
     struct p2m_domain *p2m = p2m_get_hostp2m(d);
     int ret;
-#endif
 
     if ( !paging_mode_translate(d) )
     {
+#endif
         if ( !is_iommu_enabled(d) )
             return 0;
         return iommu_legacy_unmap(d, _dfn(gfn_l), 1ul << PAGE_ORDER_4K);
+#ifdef CONFIG_HVM
     }
 
-#ifdef CONFIG_HVM
     gfn_lock(p2m, gfn, 0);
 
     mfn = p2m->get_entry(p2m, gfn, &p2mt, &a, 0, NULL, NULL);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri May 07 08:55:09 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 May 2021 08:55:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.123864.233708 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lewGI-0000a3-Nz; Fri, 07 May 2021 08:55:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 123864.233708; Fri, 07 May 2021 08:55:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lewGI-0000Zv-L7; Fri, 07 May 2021 08:55:06 +0000
Received: by outflank-mailman (input) for mailman id 123864;
 Fri, 07 May 2021 08:55:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lewGH-0000Zj-9X
 for xen-changelog@lists.xenproject.org; Fri, 07 May 2021 08:55:05 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lewGH-0003NR-6s
 for xen-changelog@lists.xenproject.org; Fri, 07 May 2021 08:55:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lewGH-0005RB-4A
 for xen-changelog@lists.xenproject.org; Fri, 07 May 2021 08:55:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Vg2hKR2nbtoErM6Kl5QLF9HBVfS5Hcp0CdA6sru/GeY=; b=u2kABdsWSCwtnkzNVqssMOxbLl
	J7pTGMrX8xqDxghDV1pPhd3bRlVGRFZMY0wUtrhcWo/HPxx3CW7rAUOEQz4kXuD4vo4dS2KZC2FFw
	3Mu99zmT+eSIBPno1qeUecpeMthi3D9WTN4WWjHK+vdSpHfselB9qaMwYYfqFI+F2bJs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/vhpet: fix RTC special casing
Message-Id: <E1lewGH-0005RB-4A@xenbits.xenproject.org>
Date: Fri, 07 May 2021 08:55:05 +0000

commit 472a13988a051e5ae84b95815c6caf4378062abe
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Fri May 7 10:43:29 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri May 7 10:43:29 2021 +0200

    x86/vhpet: fix RTC special casing
    
    Restore setting the virtual timer callback private data to NULL if the
    timer is not level triggered. This fixes the special casing done in
    pt_update_irq so that the RTC interrupt when originating from the HPET
    is suspended if the interrupt source is masked.
    
    Note the RTC special casing done in pt_update_irq should only apply to
    the RTC interrupt originating from the emulated RTC device (which does
    set the callback private data), as in that case the callback itself
    will destroy the virtual timer if the interrupt is ignored.
    
    While there also use RTC_IRQ instead of 8 when the HPET is configured
    in LegacyReplacement Mode.
    
    Fixes: be07023be115 ("x86/vhpet: add support for level triggered interrupts")
    Reported-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/hpet.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/hvm/hpet.c b/xen/arch/x86/hvm/hpet.c
index ca94e8b453..ee756abb82 100644
--- a/xen/arch/x86/hvm/hpet.c
+++ b/xen/arch/x86/hvm/hpet.c
@@ -22,6 +22,7 @@
 #include <asm/hvm/trace.h>
 #include <asm/current.h>
 #include <asm/hpet.h>
+#include <asm/mc146818rtc.h>
 #include <xen/sched.h>
 #include <xen/event.h>
 #include <xen/trace.h>
@@ -290,7 +291,7 @@ static void hpet_set_timer(HPETState *h, unsigned int tn,
         /* if LegacyReplacementRoute bit is set, HPET specification requires
            timer0 be routed to IRQ0 in NON-APIC or IRQ2 in the I/O APIC,
            timer1 be routed to IRQ8 in NON-APIC or IRQ8 in the I/O APIC. */
-        irq = (tn == 0) ? 0 : 8;
+        irq = (tn == 0) ? 0 : RTC_IRQ;
         h->pt[tn].source = PTSRC_isa;
     }
     else
@@ -318,7 +319,8 @@ static void hpet_set_timer(HPETState *h, unsigned int tn,
                          hpet_tick_to_ns(h, diff),
                          oneshot ? 0 : hpet_tick_to_ns(h, h->hpet.period[tn]),
                          irq, timer_level(h, tn) ? hpet_timer_fired : NULL,
-                         (void *)(unsigned long)tn, timer_level(h, tn));
+                         timer_level(h, tn) ? (void *)(unsigned long)tn : NULL,
+                         timer_level(h, tn));
 }
 
 static inline uint64_t hpet_fixup_reg(
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri May 07 08:55:16 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 May 2021 08:55:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.123865.233713 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lewGS-0000d3-Pr; Fri, 07 May 2021 08:55:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 123865.233713; Fri, 07 May 2021 08:55:16 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lewGS-0000cv-MZ; Fri, 07 May 2021 08:55:16 +0000
Received: by outflank-mailman (input) for mailman id 123865;
 Fri, 07 May 2021 08:55:15 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lewGR-0000cU-At
 for xen-changelog@lists.xenproject.org; Fri, 07 May 2021 08:55:15 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lewGR-0003NZ-A4
 for xen-changelog@lists.xenproject.org; Fri, 07 May 2021 08:55:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lewGR-0005Ry-95
 for xen-changelog@lists.xenproject.org; Fri, 07 May 2021 08:55:15 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=GjpzYXn5rSfuvqRk+qDahebF5SNa4TDbH6W5a0YTeck=; b=pRxmgDueupeSZ6zG3qA9JpczHj
	dadAlx3JsJhKPYzjABQzSvgRhUnDk/lyz9nYsvKuBZrS3JYcdt36sAwE43cDZRjjzT9LVe37KN+2l
	kbafascqOLqu3VN7Ts0MNGpSFWPlygkwBUhhl4VsDbknm8bLr1fhbjOpq+xCAasaUGvY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] Arm/optee: don't open-code xzalloc_flex_struct()
Message-Id: <E1lewGR-0005Ry-95@xenbits.xenproject.org>
Date: Fri, 07 May 2021 08:55:15 +0000

commit 7a2b787880bddbb3bd68b18efe1d6fe339df6ff1
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri May 7 10:45:14 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri May 7 10:45:14 2021 +0200

    Arm/optee: don't open-code xzalloc_flex_struct()
    
    The current use of xzalloc_bytes() in optee is nearly an open-coded
    version  of xzalloc_flex_struct(), which was introduced after the driver
    was merged.
    
    The main difference is xzalloc_bytes() will also force the allocation to
    be SMP_CACHE_BYTES aligned and therefore avoid sharing the cache line.
    While sharing the cache line can have an impact on the performance, this
    is also true for most of the other users of x*alloc(), x*alloc_array(),
    and x*alloc_flex_struct(). So if we want to prevent sharing cache lines,
    arranging for this should be done in the allocator itself.
    
    In this case, we don't need stricter alignment than what the allocator
    provides. Hence replace the call to xzalloc_bytes() with one of
    xzalloc_flex_struct().
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Julien Grall <julien@xen.org>
    Acked-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
---
 xen/arch/arm/tee/optee.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/xen/arch/arm/tee/optee.c b/xen/arch/arm/tee/optee.c
index 9570dc6771..980eebe847 100644
--- a/xen/arch/arm/tee/optee.c
+++ b/xen/arch/arm/tee/optee.c
@@ -529,8 +529,7 @@ static struct optee_shm_buf *allocate_optee_shm_buf(struct optee_domain *ctx,
     while ( unlikely(old != atomic_cmpxchg(&ctx->optee_shm_buf_pages,
                                            old, new)) );
 
-    optee_shm_buf = xzalloc_bytes(sizeof(struct optee_shm_buf) +
-                                  pages_cnt * sizeof(struct page *));
+    optee_shm_buf = xzalloc_flex_struct(struct optee_shm_buf, pages, pages_cnt);
     if ( !optee_shm_buf )
     {
         err_code = -ENOMEM;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri May 07 09:55:07 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 May 2021 09:55:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.123915.233810 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lexCJ-0001pU-8M; Fri, 07 May 2021 09:55:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 123915.233810; Fri, 07 May 2021 09:55:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lexCJ-0001pM-5I; Fri, 07 May 2021 09:55:03 +0000
Received: by outflank-mailman (input) for mailman id 123915;
 Fri, 07 May 2021 09:55:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lexCI-0001pE-11
 for xen-changelog@lists.xenproject.org; Fri, 07 May 2021 09:55:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lexCI-0004Xy-0A
 for xen-changelog@lists.xenproject.org; Fri, 07 May 2021 09:55:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lexCH-0001kE-Vc
 for xen-changelog@lists.xenproject.org; Fri, 07 May 2021 09:55:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=RrOczT6EF5PsN8g/O2WJ8ctoDYTsp0awct9rzpfNtA0=; b=ExBgkfttS5n/KR1RAn2o5WgcGY
	46rYzSbCqSZOttH/tIZS0XhqfHJy4vbjU756caAsKCpjcf5hsAO88fW7xDdUfbNGpdM457zBW7j01
	621kZmT5fZ5IUXITdFtzrdp1hLwqVR8H9r6ZXnBkHtGlRdk6moheKfURbinPHQD7KT3s=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.12] crypto: adjust rijndaelEncrypt() prototype for gcc11
Message-Id: <E1lexCH-0001kE-Vc@xenbits.xenproject.org>
Date: Fri, 07 May 2021 09:55:01 +0000

commit 70c53eaf596ef34c202257418e6684803cd96a4c
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 18 15:09:38 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 18 15:09:38 2021 +0100

    crypto: adjust rijndaelEncrypt() prototype for gcc11
    
    The upcoming release complains, not entirely unreasonably:
    
    In file included from rijndael.c:33:
    .../xen/include/crypto/rijndael.h:55:53: note: previously declared as 'const unsigned char[]'
       55 | void    rijndaelEncrypt(const unsigned int [], int, const unsigned char [],
          |                                                     ^~~~~~~~~~~~~~~~~~~~~~
    rijndael.c:865:8: error: argument 4 of type 'u8[16]' {aka 'unsigned char[16]'} with mismatched bound [-Werror=array-parameter=]
      865 |     u8 ct[16])
          |     ~~~^~~~~~
    In file included from rijndael.c:33:
    .../xen/include/crypto/rijndael.h:56:13: note: previously declared as 'unsigned char[]'
       56 |             unsigned char []);
          |             ^~~~~~~~~~~~~~~~
    
    Simply declare the correct array dimensions right away. This then allows
    compilers to apply checking at call sites, which seems desirable anyway.
    
    For the moment I'm leaving untouched the disagreement between u8/u32
    used in the function definition and unsigned {char,int} used in the
    declaration, as making this consistent would call for touching further
    functions.
    
    Reported-by: Charles Arnold <carnold@suse.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
    master commit: c6ad5a701b9a6df443a6c98d9e7201c958bbcafc
    master date: 2021-03-04 16:47:51 +0100
---
 xen/include/crypto/rijndael.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/include/crypto/rijndael.h b/xen/include/crypto/rijndael.h
index 69965783c5..4386be5878 100644
--- a/xen/include/crypto/rijndael.h
+++ b/xen/include/crypto/rijndael.h
@@ -52,7 +52,7 @@ void	 rijndael_encrypt(rijndael_ctx *, const unsigned char *, unsigned char *);
 
 int	rijndaelKeySetupEnc(unsigned int [], const unsigned char [], int);
 int	rijndaelKeySetupDec(unsigned int [], const unsigned char [], int);
-void	rijndaelEncrypt(const unsigned int [], int, const unsigned char [],
-	    unsigned char []);
+void	rijndaelEncrypt(const unsigned int [], int, const unsigned char [16],
+	    unsigned char [16]);
 
 #endif /* __RIJNDAEL_H */
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.12


From xen-changelog-bounces@lists.xenproject.org Fri May 07 09:55:13 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 May 2021 09:55:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.123916.233814 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lexCT-0001sK-9w; Fri, 07 May 2021 09:55:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 123916.233814; Fri, 07 May 2021 09:55:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lexCT-0001sC-6u; Fri, 07 May 2021 09:55:13 +0000
Received: by outflank-mailman (input) for mailman id 123916;
 Fri, 07 May 2021 09:55:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lexCS-0001s0-4Y
 for xen-changelog@lists.xenproject.org; Fri, 07 May 2021 09:55:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lexCS-0004Y6-3n
 for xen-changelog@lists.xenproject.org; Fri, 07 May 2021 09:55:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lexCS-0001l1-2o
 for xen-changelog@lists.xenproject.org; Fri, 07 May 2021 09:55:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=sTJQXqXzfDNfHrMZ8NujunALlFLPkJMVizcA8WmlmzY=; b=Dei7tMcVGjgizBrN2Zmmwf6Vnv
	MGEKmBXsXJ/hB5vJpiYuCD/JB6xHZAKpQbxNnhHeJ14zCFacVpFpzJfhvYSg50rTDzZeIUo7OlygT
	EHdNCvLa+H0w3DPWnHGq9FKpM3uvQaI+Vr6x5jqxVPE8rEZD3sIEh9pSkr56CRGhLfco=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.12] libxl: Fix domain soft reset state handling
Message-Id: <E1lexCS-0001l1-2o@xenbits.xenproject.org>
Date: Fri, 07 May 2021 09:55:12 +0000

commit b8737d236e525315504fc7b271de21101288d67f
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Thu Mar 18 15:10:37 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 18 15:10:37 2021 +0100

    libxl: Fix domain soft reset state handling
    
    In do_domain_soft_reset(), a `libxl__domain_suspend_state' is used
    without been properly initialised and disposed of. This lead do a
    abort() in libxl due to the `dsps.qmp' state been used before been
    initialised:
        libxl__ev_qmp_send: Assertion `ev->state == qmp_state_disconnected || ev->state == qmp_state_connected' failed.
    
    Once initialised, `dsps' also needs to be disposed of as the `qmp'
    state might still be in the `Connected' state in the callback for
    libxl__domain_suspend_device_model(). So this patch adds
    libxl__domain_suspend_dispose() which can be called from the two
    places where we need to dispose of `dsps'.
    
    This is XSA-368.
    
    Reported-by: Olaf Hering <olaf@aepfle.de>
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Reviewed-by: Ian Jackson <iwj@xenproject.org>
    Tested-by: Olaf Hering <olaf@aepfle.de>
    master commit: dae3c3e8b257cd27d6b35a467a34bf79a6650340
    master date: 2021-03-18 14:56:33 +0100
---
 tools/libxl/libxl_create.c      | 11 ++++++++---
 tools/libxl/libxl_dom_suspend.c | 15 +++++++++++----
 tools/libxl/libxl_internal.h    |  2 ++
 3 files changed, 21 insertions(+), 7 deletions(-)

diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c
index a4e74a5cd2..f436a967aa 100644
--- a/tools/libxl/libxl_create.c
+++ b/tools/libxl/libxl_create.c
@@ -1848,9 +1848,7 @@ static int do_domain_soft_reset(libxl_ctx *ctx,
     state->console_tty = libxl__strdup(gc, console_tty);
 
     dss->ao = ao;
-    dss->domid = dss->dsps.domid = domid_soft_reset;
-    dss->dsps.dm_savefile = GCSPRINTF(LIBXL_DEVICE_MODEL_SAVE_FILE".%d",
-                                      domid_soft_reset);
+    dss->domid = domid_soft_reset;
 
     rc = libxl__save_emulator_xenstore_data(dss, &srs->toolstack_buf,
                                             &srs->toolstack_len);
@@ -1860,6 +1858,11 @@ static int do_domain_soft_reset(libxl_ctx *ctx,
     }
 
     dss->dsps.ao = ao;
+    dss->dsps.domid = domid_soft_reset;
+    dss->dsps.live = false;
+    rc = libxl__domain_suspend_init(egc, &dss->dsps, d_config->b_info.type);
+    if (rc)
+        goto out;
     dss->dsps.callback_device_model_done = soft_reset_dm_suspended;
     libxl__domain_suspend_device_model(egc, &dss->dsps); /* must be last */
 
@@ -1878,6 +1881,8 @@ static void soft_reset_dm_suspended(libxl__egc *egc,
         CONTAINER_OF(dsps, *srs, dss.dsps);
     libxl__app_domain_create_state *cdcs = &srs->cdcs;
 
+    libxl__domain_suspend_dispose(gc, dsps);
+
     /*
      * Ask all backends to disconnect by removing the domain from
      * xenstore. On the creation path the domain will be introduced to
diff --git a/tools/libxl/libxl_dom_suspend.c b/tools/libxl/libxl_dom_suspend.c
index d1af3a6573..8e7c3464ae 100644
--- a/tools/libxl/libxl_dom_suspend.c
+++ b/tools/libxl/libxl_dom_suspend.c
@@ -67,6 +67,16 @@ out:
     return rc;
 }
 
+void libxl__domain_suspend_dispose(libxl__gc *gc,
+                                   libxl__domain_suspend_state  *dsps)
+{
+    libxl__xswait_stop(gc, &dsps->pvcontrol);
+    libxl__ev_evtchn_cancel(gc, &dsps->guest_evtchn);
+    libxl__ev_xswatch_deregister(gc, &dsps->guest_watch);
+    libxl__ev_time_deregister(gc, &dsps->guest_timeout);
+    libxl__ev_qmp_dispose(gc, &dsps->qmp);
+}
+
 /*----- callbacks, called by xc_domain_save -----*/
 
 void libxl__domain_suspend_device_model(libxl__egc *egc,
@@ -393,10 +403,7 @@ static void domain_suspend_common_done(libxl__egc *egc,
 {
     EGC_GC;
     assert(!libxl__xswait_inuse(&dsps->pvcontrol));
-    libxl__ev_evtchn_cancel(gc, &dsps->guest_evtchn);
-    libxl__ev_xswatch_deregister(gc, &dsps->guest_watch);
-    libxl__ev_time_deregister(gc, &dsps->guest_timeout);
-    libxl__ev_qmp_dispose(gc, &dsps->qmp);
+    libxl__domain_suspend_dispose(gc, dsps);
     dsps->callback_common_done(egc, dsps, rc);
 }
 
diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h
index a119de7136..6e1caff2c3 100644
--- a/tools/libxl/libxl_internal.h
+++ b/tools/libxl/libxl_internal.h
@@ -3443,6 +3443,8 @@ struct libxl__domain_suspend_state {
 int libxl__domain_suspend_init(libxl__egc *egc,
                                libxl__domain_suspend_state *dsps,
                                libxl_domain_type type);
+void libxl__domain_suspend_dispose(libxl__gc *gc,
+                                   libxl__domain_suspend_state  *dsps);
 
 /* calls dsps->callback_device_model_done when done
  * may synchronously calls this callback */
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.12


From xen-changelog-bounces@lists.xenproject.org Fri May 07 09:55:23 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 May 2021 09:55:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.123917.233817 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lexCd-0001wF-Cu; Fri, 07 May 2021 09:55:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 123917.233817; Fri, 07 May 2021 09:55:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lexCd-0001w7-A2; Fri, 07 May 2021 09:55:23 +0000
Received: by outflank-mailman (input) for mailman id 123917;
 Fri, 07 May 2021 09:55:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lexCc-0001vl-7O
 for xen-changelog@lists.xenproject.org; Fri, 07 May 2021 09:55:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lexCc-0004Ya-6a
 for xen-changelog@lists.xenproject.org; Fri, 07 May 2021 09:55:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lexCc-0001lh-5r
 for xen-changelog@lists.xenproject.org; Fri, 07 May 2021 09:55:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=OAO0rscZabiz5DJCo72Zm01APPvO6NWnProqQRrKNGs=; b=Ft94d+m1feHmzjbSTLeniLFfDi
	po3MUBSpxIiwqTNnRcdGBzBDBsuZ4OUPvHQMKyU4d681m5SyLTQXH+QeFx4JLlOZejMzxL5tPsfu+
	SGr+hZ5n/vM1zac0kExHVHL38sOIeVHBcfSg/mabKwmbs8hTCLUUpwnAUbIWWqg5z/k8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.12] tools/ocaml: libxb: Harden stub_header_of_string()
Message-Id: <E1lexCc-0001lh-5r@xenbits.xenproject.org>
Date: Fri, 07 May 2021 09:55:22 +0000

commit 652a259ea8115c25ee081f022ab06c9d4b748429
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Mon Mar 30 14:29:10 2020 +0100
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Fri Mar 19 13:46:43 2021 +0000

    tools/ocaml: libxb: Harden stub_header_of_string()
    
    stub_header_of_string() should not modify the header. So mark the
    variable 'hdr' as const.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
    (cherry picked from commit d92ba1aa7cf877a77abdcbd94a6a19fc55886a75)
---
 tools/ocaml/libs/xb/xenbus_stubs.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/ocaml/libs/xb/xenbus_stubs.c b/tools/ocaml/libs/xb/xenbus_stubs.c
index a68e783f70..001bb03371 100644
--- a/tools/ocaml/libs/xb/xenbus_stubs.c
+++ b/tools/ocaml/libs/xb/xenbus_stubs.c
@@ -40,12 +40,12 @@ CAMLprim value stub_header_of_string(value s)
 {
 	CAMLparam1(s);
 	CAMLlocal1(ret);
-	struct xsd_sockmsg *hdr;
+	const struct xsd_sockmsg *hdr;
 
 	if (caml_string_length(s) != sizeof(struct xsd_sockmsg))
 		caml_failwith("xb header incomplete");
 	ret = caml_alloc_tuple(4);
-	hdr = (struct xsd_sockmsg *) String_val(s);
+	hdr = (const struct xsd_sockmsg *) String_val(s);
 	Store_field(ret, 0, Val_int(hdr->tx_id));
 	Store_field(ret, 1, Val_int(hdr->req_id));
 	Store_field(ret, 2, Val_int(hdr->type));
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.12


From xen-changelog-bounces@lists.xenproject.org Fri May 07 09:55:33 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 May 2021 09:55:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.123918.233821 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lexCn-00020L-Ef; Fri, 07 May 2021 09:55:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 123918.233821; Fri, 07 May 2021 09:55:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lexCn-00020F-BW; Fri, 07 May 2021 09:55:33 +0000
Received: by outflank-mailman (input) for mailman id 123918;
 Fri, 07 May 2021 09:55:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lexCm-0001zt-AU
 for xen-changelog@lists.xenproject.org; Fri, 07 May 2021 09:55:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lexCm-0004Ys-9j
 for xen-changelog@lists.xenproject.org; Fri, 07 May 2021 09:55:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lexCm-0001ma-8q
 for xen-changelog@lists.xenproject.org; Fri, 07 May 2021 09:55:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=g4qX2aCND9dR7nmetEZooJTk32zX+k6xuWZ7uC5ebfg=; b=prf4rMLJM4Oxj1woYVHsYAMSuY
	i/jps1flTF3Lqvh+9QM2+erh5i2fjuE1ziMtFYilblc+yZowPbhZHmmzfJMPFA0caV9BdecSvHIm/
	ORkszIvWG5JE/tNkpB0pIBuZvrREIJR+14Pvkie1wVrmXqRp3IKnX95uYRPmNf5jYHbQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.12] tools/ocaml: Fix stubs build when OCaml has been compiled with -safe-string
Message-Id: <E1lexCm-0001ma-8q@xenbits.xenproject.org>
Date: Fri, 07 May 2021 09:55:32 +0000

commit 2e9e9e440f9257f7db12a744d0de0b7ab7746dfd
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Mon Mar 30 15:14:23 2020 +0100
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Fri Mar 19 13:46:43 2021 +0000

    tools/ocaml: Fix stubs build when OCaml has been compiled with -safe-string
    
    The OCaml code has been fixed to handle properly -safe-string in Xen
    4.11, however the stubs part were missed.
    
    On OCaml newer than 4.06.1, String_Val() will return a const char *
    when using -safe-string leading to build failure when this is used
    in place where char * is expected.
    
    The main use in Xen code base is when a new string is allocated. The
    suggested approach by the OCaml community [1] is to use the helper
    caml_alloc_initialized_string() but it was introduced by OCaml 4.06.1.
    
    The next best approach is to cast String_val() to (char *) as the helper
    would have done. So use it when we need to update the new string using
    memcpy().
    
    Take the opportunity to remove the unnecessary cast of the source as
    mempcy() is expecting a void *.
    
    [1] https://github.com/ocaml/ocaml/pull/1274
    
    Reported-by: Dario Faggioli <dfaggioli@suse.com>
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
    (cherry picked from commit 59b087e3954402c487e0abb4ad9bd05f43669436)
---
 tools/ocaml/libs/xb/xenbus_stubs.c  | 2 +-
 tools/ocaml/libs/xc/xenctrl_stubs.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/ocaml/libs/xb/xenbus_stubs.c b/tools/ocaml/libs/xb/xenbus_stubs.c
index 001bb03371..3065181a55 100644
--- a/tools/ocaml/libs/xb/xenbus_stubs.c
+++ b/tools/ocaml/libs/xb/xenbus_stubs.c
@@ -65,7 +65,7 @@ CAMLprim value stub_string_of_header(value tid, value rid, value ty, value len)
 	};
 
 	ret = caml_alloc_string(sizeof(struct xsd_sockmsg));
-	memcpy(String_val(ret), &xsd, sizeof(struct xsd_sockmsg));
+	memcpy((char *) String_val(ret), &xsd, sizeof(struct xsd_sockmsg));
 
 	CAMLreturn(ret);
 }
diff --git a/tools/ocaml/libs/xc/xenctrl_stubs.c b/tools/ocaml/libs/xc/xenctrl_stubs.c
index c4fdc58b2d..cae33a8cb2 100644
--- a/tools/ocaml/libs/xc/xenctrl_stubs.c
+++ b/tools/ocaml/libs/xc/xenctrl_stubs.c
@@ -436,7 +436,7 @@ CAMLprim value stub_xc_vcpu_context_get(value xch, value domid,
 	ret = xc_vcpu_getcontext(_H(xch), _D(domid), Int_val(cpu), &ctxt);
 
 	context = caml_alloc_string(sizeof(ctxt));
-	memcpy(String_val(context), (char *) &ctxt.c, sizeof(ctxt.c));
+	memcpy((char *) String_val(context), &ctxt.c, sizeof(ctxt.c));
 
 	CAMLreturn(context);
 }
@@ -615,7 +615,7 @@ CAMLprim value stub_xc_readconsolering(value xch)
 		conring_size = size;
 
 	ring = caml_alloc_string(count);
-	memcpy(String_val(ring), str, count);
+	memcpy((char *) String_val(ring), str, count);
 	free(str);
 
 	CAMLreturn(ring);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.12


From xen-changelog-bounces@lists.xenproject.org Fri May 07 09:55:43 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 May 2021 09:55:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.123919.233826 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lexCx-00023k-G3; Fri, 07 May 2021 09:55:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 123919.233826; Fri, 07 May 2021 09:55:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lexCx-00023b-D1; Fri, 07 May 2021 09:55:43 +0000
Received: by outflank-mailman (input) for mailman id 123919;
 Fri, 07 May 2021 09:55:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lexCw-00023C-DP
 for xen-changelog@lists.xenproject.org; Fri, 07 May 2021 09:55:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lexCw-0004ZE-Cb
 for xen-changelog@lists.xenproject.org; Fri, 07 May 2021 09:55:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lexCw-0001nW-Bq
 for xen-changelog@lists.xenproject.org; Fri, 07 May 2021 09:55:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Bk5M4iQXpm2Dz9C2uA7b6EOtXsX2f4xjTb+EbzysdoY=; b=mUf87y6av7WJ9GOhqjyz+3LXFB
	s6XAfjwFIHoPRNBKDWhbpCcfU9+0r4DLxJxIQyuQ+2FKcHxe1Tz7dCq6/5zVzVouQyCWmFN7XniZ7
	trXifhg9jYwswATHWMPquaza7QBS+HJuFgNPSBXd/d/4OsLnkjEZZZTAS3a+nRB62OKg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.12] tools/ocaml: libxb: Avoid to use String_val() when value is bytes
Message-Id: <E1lexCw-0001nW-Bq@xenbits.xenproject.org>
Date: Fri, 07 May 2021 09:55:42 +0000

commit 17db0ba37c16753bfbe3be07875a3aaa579c316b
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Mon Mar 30 18:50:08 2020 +0100
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Fri Mar 19 13:46:43 2021 +0000

    tools/ocaml: libxb: Avoid to use String_val() when value is bytes
    
    Commit ec7d54dd1a "ocaml/libs/xb: Use bytes in place of strings for
    mutable buffers" switch mutable buffers from string to bytes. However
    the C code were still using String_Val() to access them.
    
    While the underlying structure is the same between string and bytes, a
    string is meant to be immutable. OCaml 4.06.1 and later will enforce it.
    Therefore, it will not be possible to build the OCaml libs when using
    -safe-string. This is because String_val() will return a const value.
    
    To avoid plain cast in the code, the code is now switched to use
    Bytes_val(). As the macro is not defined in older OCaml version, we need
    to provide a stub.
    
    Take the opportunity to switch to const the buffer in
    ml_interface_write() as it should not be modified.
    
    Reported-by: Dario Faggioli <dfaggioli@suse.com>
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
    (cherry picked from commit 78686437e949a85a207ae1a0d637efe2d3778bbe)
---
 tools/ocaml/libs/xb/xs_ring_stubs.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/tools/ocaml/libs/xb/xs_ring_stubs.c b/tools/ocaml/libs/xb/xs_ring_stubs.c
index 473787064a..7537a23949 100644
--- a/tools/ocaml/libs/xb/xs_ring_stubs.c
+++ b/tools/ocaml/libs/xb/xs_ring_stubs.c
@@ -36,6 +36,14 @@
 
 #define GET_C_STRUCT(a) ((struct mmap_interface *) a)
 
+/*
+ * Bytes_val has been introduced by Ocaml 4.06.1. So define our own version
+ * if needed.
+ */
+#ifndef Bytes_val
+#define Bytes_val(x) ((unsigned char *) Bp_val(x))
+#endif
+
 CAMLprim value ml_interface_read(value ml_interface,
                                  value ml_buffer,
                                  value ml_len)
@@ -44,7 +52,7 @@ CAMLprim value ml_interface_read(value ml_interface,
 	CAMLlocal1(ml_result);
 
 	struct mmap_interface *interface = GET_C_STRUCT(ml_interface);
-	char *buffer = String_val(ml_buffer);
+	unsigned char *buffer = Bytes_val(ml_buffer);
 	int len = Int_val(ml_len);
 	int result;
 
@@ -103,7 +111,7 @@ CAMLprim value ml_interface_write(value ml_interface,
 	CAMLlocal1(ml_result);
 
 	struct mmap_interface *interface = GET_C_STRUCT(ml_interface);
-	char *buffer = String_val(ml_buffer);
+	const unsigned char *buffer = Bytes_val(ml_buffer);
 	int len = Int_val(ml_len);
 	int result;
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.12


From xen-changelog-bounces@lists.xenproject.org Fri May 07 09:55:53 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 May 2021 09:55:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.123920.233831 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lexD7-00027N-Hn; Fri, 07 May 2021 09:55:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 123920.233831; Fri, 07 May 2021 09:55:53 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lexD7-00027D-EV; Fri, 07 May 2021 09:55:53 +0000
Received: by outflank-mailman (input) for mailman id 123920;
 Fri, 07 May 2021 09:55:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lexD6-00026r-GK
 for xen-changelog@lists.xenproject.org; Fri, 07 May 2021 09:55:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lexD6-0004ZV-Fa
 for xen-changelog@lists.xenproject.org; Fri, 07 May 2021 09:55:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lexD6-0001oN-Ev
 for xen-changelog@lists.xenproject.org; Fri, 07 May 2021 09:55:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=4rNlQ9AWVIGyI29g2i0LHEHM0blAzCq1gZTFsYBmXw4=; b=kgflVXxjujafi8LrC6DsRXejMK
	84Ags3S7v7c4bqGTK+D7IIWfpejg4kJql1ZDUxVGJo84SNg4rhwZYd/T07kcJJfPPHzTylkY00b0E
	UFiFhCEHZBIoCznobLVdbnwC3as48sVwqICgjWeVHiO0rZlY/bvqESw1y9v0JvQBXJk0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.12] tools/libxc: misc: Mark const the parameter 'keys' of xc_send_debug_keys()
Message-Id: <E1lexD6-0001oN-Ev@xenbits.xenproject.org>
Date: Fri, 07 May 2021 09:55:52 +0000

commit b100d3e9acef5b0259b1826c310e90801cf29c01
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Mon Mar 30 20:21:52 2020 +0100
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Fri Mar 19 13:46:44 2021 +0000

    tools/libxc: misc: Mark const the parameter 'keys' of xc_send_debug_keys()
    
    OCaml is using a string to describe the parameter 'keys' of
    xc_send_debug_keys(). Since Ocaml 4.06.01, String_val() will return a
    const char * when using -safe-string. This will result to a build
    failure because xc_send_debug_keys() expects a char *.
    
    The function should never modify the parameter 'keys' and therefore the
    parameter should be const. Unfortunately, this is not directly possible
    because DECLARE_HYPERCALL_BOUNCE() is expecting a non-const variable.
    
    A new macro DECLARE_HYPERCALL_BOUNCE_IN() is introduced and will take
    care of const parameter. The first user will be xc_send_debug_keys() but
    this can be used in more place in the future.
    
    Reported-by: Dario Faggioli <dfaggioli@suse.com>
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Ian Jackson <ian.jackson@eu.citrix.com>
    (cherry picked from commit 2b8079610ec55413613ad071cc81cd9f97232a7e)
---
 tools/libxc/include/xenctrl.h | 2 +-
 tools/libxc/xc_misc.c         | 4 ++--
 tools/libxc/xc_private.h      | 8 ++++++++
 3 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/tools/libxc/include/xenctrl.h b/tools/libxc/include/xenctrl.h
index 31cdda76c6..833e12d5a1 100644
--- a/tools/libxc/include/xenctrl.h
+++ b/tools/libxc/include/xenctrl.h
@@ -1226,7 +1226,7 @@ int xc_readconsolering(xc_interface *xch,
                        unsigned int *pnr_chars,
                        int clear, int incremental, uint32_t *pindex);
 
-int xc_send_debug_keys(xc_interface *xch, char *keys);
+int xc_send_debug_keys(xc_interface *xch, const char *keys);
 int xc_set_parameters(xc_interface *xch, char *params);
 
 typedef struct xen_sysctl_physinfo xc_physinfo_t;
diff --git a/tools/libxc/xc_misc.c b/tools/libxc/xc_misc.c
index 5e6714ae2b..8f2a2dee36 100644
--- a/tools/libxc/xc_misc.c
+++ b/tools/libxc/xc_misc.c
@@ -167,11 +167,11 @@ int xc_readconsolering(xc_interface *xch,
     return ret;
 }
 
-int xc_send_debug_keys(xc_interface *xch, char *keys)
+int xc_send_debug_keys(xc_interface *xch, const char *keys)
 {
     int ret, len = strlen(keys);
     DECLARE_SYSCTL;
-    DECLARE_HYPERCALL_BOUNCE(keys, len, XC_HYPERCALL_BUFFER_BOUNCE_IN);
+    DECLARE_HYPERCALL_BOUNCE_IN(keys, len);
 
     if ( xc_hypercall_bounce_pre(xch, keys) )
         return -1;
diff --git a/tools/libxc/xc_private.h b/tools/libxc/xc_private.h
index adc3b6a571..c77edb3c4c 100644
--- a/tools/libxc/xc_private.h
+++ b/tools/libxc/xc_private.h
@@ -181,6 +181,14 @@ enum {
  */
 #define DECLARE_HYPERCALL_BOUNCE(_ubuf, _sz, _dir) DECLARE_NAMED_HYPERCALL_BOUNCE(_ubuf, _ubuf, _sz, _dir)
 
+/*
+ * Declare a bounce buffer shadowing the named user data pointer that
+ * cannot be modified.
+ */
+#define DECLARE_HYPERCALL_BOUNCE_IN(_ubuf, _sz)                     \
+    DECLARE_NAMED_HYPERCALL_BOUNCE(_ubuf, (void *)(_ubuf), _sz,     \
+                                   XC_HYPERCALL_BUFFER_BOUNCE_IN)
+
 /*
  * Set the size of data to bounce. Useful when the size is not known
  * when the bounce buffer is declared.
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.12


From xen-changelog-bounces@lists.xenproject.org Fri May 07 09:56:03 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 May 2021 09:56:03 +0000
Received: from list by lists.xenproject.org with outflank-mailman.123923.233833 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lexDH-0002Ar-Ir; Fri, 07 May 2021 09:56:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 123923.233833; Fri, 07 May 2021 09:56:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lexDH-0002Ak-G5; Fri, 07 May 2021 09:56:03 +0000
Received: by outflank-mailman (input) for mailman id 123923;
 Fri, 07 May 2021 09:56:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lexDG-0002AX-JI
 for xen-changelog@lists.xenproject.org; Fri, 07 May 2021 09:56:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lexDG-0004bG-IN
 for xen-changelog@lists.xenproject.org; Fri, 07 May 2021 09:56:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lexDG-0001pY-Hc
 for xen-changelog@lists.xenproject.org; Fri, 07 May 2021 09:56:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=VsNM+L0B+vtVm705bEimBkLMqcumYblzO74acpP/2IY=; b=lNmGSCY5hnMwsufCMcA5Tdl0v2
	B9MhXgQpt5gA5+XwoovKTv+gyz/EQu4jS91/J4ZXPm7ve418ZRfAIx5ebqw9z0qkOKFqrQFysshpI
	W4g9Bij0rwL8NUK2i/IaN5Ogn2V7buu9hoLN+efNSOOuYIOvbI1jjfdQ24uHaG6M+4Js=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.12] oxenstored: fix ABI breakage introduced in Xen 4.9.0
Message-Id: <E1lexDG-0001pY-Hc@xenbits.xenproject.org>
Date: Fri, 07 May 2021 09:56:02 +0000

commit 26764c58a4d5e733d7ba7266c85b6f23b6701ec2
Author:     Edwin Török <edvin.torok@citrix.com>
AuthorDate: Wed Jul 15 16:10:56 2020 +0100
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Fri Mar 19 13:46:44 2021 +0000

    oxenstored: fix ABI breakage introduced in Xen 4.9.0
    
    dbc84d2983969bb47d294131ed9e6bbbdc2aec49 (Xen >= 4.9.0) deleted XS_RESTRICT
    from oxenstored, which caused all the following opcodes to be shifted by 1:
    reset_watches became off-by-one compared to the C version of xenstored.
    
    Looking at the C code the opcode for reset watches needs:
    XS_RESET_WATCHES = XS_SET_TARGET + 2
    
    So add the placeholder `Invalid` in the OCaml<->C mapping list.
    (Note that the code here doesn't simply convert the OCaml constructor to
     an integer, so we don't need to introduce a dummy constructor).
    
    Igor says that with a suitably patched xenopsd to enable watch reset,
    we now see `reset watches` during kdump of a guest in xenstored-access.log.
    
    Signed-off-by: Edwin Török <edvin.torok@citrix.com>
    Tested-by: Igor Druzhinin <igor.druzhinin@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
    (cherry picked from commit a6ed77f1e0334c26e6e216aea45f8674d9284856)
    (cherry picked from commit 9503a6df19924d2d9bf5b5a663342ba1507819c5)
---
 tools/ocaml/libs/xb/op.ml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/ocaml/libs/xb/op.ml b/tools/ocaml/libs/xb/op.ml
index d4f1f08185..9bcab0f38c 100644
--- a/tools/ocaml/libs/xb/op.ml
+++ b/tools/ocaml/libs/xb/op.ml
@@ -28,7 +28,7 @@ let operation_c_mapping =
            Transaction_end; Introduce; Release;
            Getdomainpath; Write; Mkdir; Rm;
            Setperms; Watchevent; Error; Isintroduced;
-           Resume; Set_target; Reset_watches |]
+           Resume; Set_target; Invalid; Reset_watches |]
 let size = Array.length operation_c_mapping
 
 let array_search el a =
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.12


From xen-changelog-bounces@lists.xenproject.org Fri May 07 09:56:13 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 May 2021 09:56:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.123924.233837 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lexDR-0002Dk-Ke; Fri, 07 May 2021 09:56:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 123924.233837; Fri, 07 May 2021 09:56:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lexDR-0002Dc-Hk; Fri, 07 May 2021 09:56:13 +0000
Received: by outflank-mailman (input) for mailman id 123924;
 Fri, 07 May 2021 09:56:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lexDQ-0002DL-MR
 for xen-changelog@lists.xenproject.org; Fri, 07 May 2021 09:56:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lexDQ-0004bg-Lf
 for xen-changelog@lists.xenproject.org; Fri, 07 May 2021 09:56:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lexDQ-0001qp-Ke
 for xen-changelog@lists.xenproject.org; Fri, 07 May 2021 09:56:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=4x5qlqqiGKPNZpBVaLJQdARJgfE3Ks4DBoYFDNBoBcM=; b=u+R8fka2uP/4U9hBKYB5fRENGQ
	7NCHgx4Hyhyc7H8eCNKPlt7vs3X5caYkTLEZDvYpTZaSL0clj2FXogTmkaW+v/YjdAUl/N7TVxt9B
	BH0YXc+4NVIeWmgTi9aCOTd37tLhY/QkfD75cC0cR2+5kWgLKpZZCC7cXLpgLf/r8RHg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.12] tools/ocaml/libs/xb: Do not crash after xenbus is unmapped
Message-Id: <E1lexDQ-0001qp-Ke@xenbits.xenproject.org>
Date: Fri, 07 May 2021 09:56:12 +0000

commit f66542f5d2217f3868d78ff64d11a2a02674fed9
Author:     Edwin Török <edvin.torok@citrix.com>
AuthorDate: Fri Jan 15 18:23:10 2021 +0000
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Fri Mar 19 13:46:44 2021 +0000

    tools/ocaml/libs/xb: Do not crash after xenbus is unmapped
    
    Xenmmap.unmap sets the address to MAP_FAILED in xenmmap_stubs.c.  If due to a
    bug there were still references to the Xenbus and we attempt to use it then we
    crash.  Raise an exception instead of crashing.
    
    Signed-off-by: Edwin Török <edvin.torok@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    (cherry picked from commit 5e317896342d553f0b55f72948bbf93a0f1147d3)
---
 tools/ocaml/libs/xb/xs_ring_stubs.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tools/ocaml/libs/xb/xs_ring_stubs.c b/tools/ocaml/libs/xb/xs_ring_stubs.c
index 7537a23949..7a91fdee75 100644
--- a/tools/ocaml/libs/xb/xs_ring_stubs.c
+++ b/tools/ocaml/libs/xb/xs_ring_stubs.c
@@ -32,6 +32,7 @@
 #include <caml/fail.h>
 #include <caml/callback.h>
 
+#include <sys/mman.h>
 #include "mmap_stubs.h"
 
 #define GET_C_STRUCT(a) ((struct mmap_interface *) a)
@@ -166,6 +167,8 @@ CAMLprim value ml_interface_set_server_features(value interface, value v)
 {
 	CAMLparam2(interface, v);
 	struct xenstore_domain_interface *intf = GET_C_STRUCT(interface)->addr;
+	if (intf == (void*)MAP_FAILED)
+		caml_failwith("Interface closed");
 
 	intf->server_features = Int_val(v);
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.12


From xen-changelog-bounces@lists.xenproject.org Fri May 07 09:56:23 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 May 2021 09:56:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.123925.233842 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lexDb-0002Gn-MQ; Fri, 07 May 2021 09:56:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 123925.233842; Fri, 07 May 2021 09:56:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lexDb-0002Gf-JJ; Fri, 07 May 2021 09:56:23 +0000
Received: by outflank-mailman (input) for mailman id 123925;
 Fri, 07 May 2021 09:56:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lexDa-0002GV-Pt
 for xen-changelog@lists.xenproject.org; Fri, 07 May 2021 09:56:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lexDa-0004c5-P8
 for xen-changelog@lists.xenproject.org; Fri, 07 May 2021 09:56:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lexDa-0001rj-Ny
 for xen-changelog@lists.xenproject.org; Fri, 07 May 2021 09:56:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=3/24qqbofqhQQikht7WGItzJxFmP3kq7oYW53ZoiPz0=; b=oiByb8hIaybDNsh2IrYlg/YTFw
	AookD5gWrw9OoKtWwhZP1zZVFBgIrieG8FW0It66VuMoUiCKYKLglVcrvNXBNXVX4UZia3pCsUhAC
	gmYOQ+ltbSwZGnTz69tYZHmeSKOF7Rp7evioZ8i1pXPFx2AdhT3yjtlm80NceZdoeM+8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.12] tools/oxenstored: Trim txhistory on xenbus reconnect
Message-Id: <E1lexDa-0001rj-Ny@xenbits.xenproject.org>
Date: Fri, 07 May 2021 09:56:22 +0000

commit b406997251c508209e0359e3d34208ced4f60d3c
Author:     Edwin Török <edvin.torok@citrix.com>
AuthorDate: Fri Jan 8 11:57:37 2021 +0000
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Fri Mar 19 13:46:44 2021 +0000

    tools/oxenstored: Trim txhistory on xenbus reconnect
    
    There is a global history, containing transactions from the past 0.05s, which
    get trimmed whenever any transaction commits or aborts.  Destroying a domain
    will cause xenopsd to perform some transactions deleting the tree, so that is
    fine.  But I think that a domain can abuse the xenbus reconnect facility to
    cause a large history to be recorded - provided that noone does any
    transactions on the system inbetween, which may be difficult to achieve given
    squeezed's constant pinging.
    
    The theoretical situation is like this:
    - a domain starts a transaction, creates as large a tree as it can, commits
      it. Then repeatedly:
        - start a transaction, do nothing with it, start a transaction, delete
          part of the large tree, write some new unique data there, don't commit
        - cause a xenbus reconnect (I think this can be done by writing something
          to the ring). This causes all transactions/watches for the connection to
          be cleared, but NOT the history, there were no commits, so nobody
          trimmed the history, i.e. it the history can contain transactions from
          more than just 0.05s
        - loop back and start more transactions, you can keep this up indefinitely
          without hitting quotas
    
    Now there is a periodic History.trim running every 0.05s, so I don't think you
    can do much damage with it.  But lets be safe an trim the transaction history
    anyway on reconnect.
    
    Signed-off-by: Edwin Török <edvin.torok@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
    (cherry picked from commit 2a47797d1f3b14aab4f0368ab833abd311f94a70)
---
 tools/ocaml/xenstored/connection.ml | 2 +-
 tools/ocaml/xenstored/history.ml    | 4 ++++
 tools/ocaml/xenstored/process.ml    | 4 ++--
 3 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/tools/ocaml/xenstored/connection.ml b/tools/ocaml/xenstored/connection.ml
index fa0d3c4d92..850539e43a 100644
--- a/tools/ocaml/xenstored/connection.ml
+++ b/tools/ocaml/xenstored/connection.ml
@@ -47,7 +47,7 @@ let mark_as_bad con =
 
 let initial_next_tid = 1
 
-let reconnect con =
+let do_reconnect con =
 	Xenbus.Xb.reconnect con.xb;
 	(* dom is the same *)
 	Hashtbl.clear con.transactions;
diff --git a/tools/ocaml/xenstored/history.ml b/tools/ocaml/xenstored/history.ml
index f39565bff5..3899353da8 100644
--- a/tools/ocaml/xenstored/history.ml
+++ b/tools/ocaml/xenstored/history.ml
@@ -53,6 +53,10 @@ let end_transaction txn con tid commit =
 	trim ~txn ();
 	success
 
+let reconnect con =
+	trim ();
+	Connection.do_reconnect con
+
 let push (x: history_record) =
 	let dom = x.con.Connection.dom in
 	match dom with
diff --git a/tools/ocaml/xenstored/process.ml b/tools/ocaml/xenstored/process.ml
index f51979926a..e9e2fc4810 100644
--- a/tools/ocaml/xenstored/process.ml
+++ b/tools/ocaml/xenstored/process.ml
@@ -560,7 +560,7 @@ let do_input store cons doms con =
 			Connection.do_input con
 		with Xenbus.Xb.Reconnect ->
 			info "%s requests a reconnect" (Connection.get_domstr con);
-			Connection.reconnect con;
+			History.reconnect con;
 			info "%s reconnection complete" (Connection.get_domstr con);
 			false
 		| Failure exp ->
@@ -599,7 +599,7 @@ let do_output _store _cons _doms con =
 			ignore (Connection.do_output con)
 		with Xenbus.Xb.Reconnect ->
 			info "%s requests a reconnect" (Connection.get_domstr con);
-			Connection.reconnect con;
+			History.reconnect con;
 			info "%s reconnection complete" (Connection.get_domstr con)
 	)
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.12


From xen-changelog-bounces@lists.xenproject.org Fri May 07 09:56:34 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 May 2021 09:56:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.123926.233846 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lexDm-0002Kd-PL; Fri, 07 May 2021 09:56:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 123926.233846; Fri, 07 May 2021 09:56:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lexDm-0002KV-MJ; Fri, 07 May 2021 09:56:34 +0000
Received: by outflank-mailman (input) for mailman id 123926;
 Fri, 07 May 2021 09:56:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lexDk-0002KE-Sh
 for xen-changelog@lists.xenproject.org; Fri, 07 May 2021 09:56:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lexDk-0004cK-S1
 for xen-changelog@lists.xenproject.org; Fri, 07 May 2021 09:56:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lexDk-0001se-RL
 for xen-changelog@lists.xenproject.org; Fri, 07 May 2021 09:56:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=zcKDUXPBm17TTytKAoX9niMElFoB8G0RbyeCNFIuiZo=; b=qg5Ph8XEydzFHBYGooMi6dHQOC
	fJOIjQow0vR4q1eWGZQQnXMbBQ6ZgWoCCsmwPsTadChdRUzh5m/mjY6okmLRBYaioY27jaXeNyHnn
	dvrQgT/ysb5s2ro/3Qo/ZqVqkGQ2vvBBiJP79eyCBJ3jLDaZy0zbJAeoAeldMuI7XJUY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.12] tools/oxenstored: Fix quota calculation for mkdir EEXIST
Message-Id: <E1lexDk-0001se-RL@xenbits.xenproject.org>
Date: Fri, 07 May 2021 09:56:32 +0000

commit 1df73ab47bde4a83676f74ed28b48cda9ff881db
Author:     Edwin Török <edvin.torok@citrix.com>
AuthorDate: Fri Jan 15 19:11:32 2021 +0000
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Fri Mar 19 13:46:44 2021 +0000

    tools/oxenstored: Fix quota calculation for mkdir EEXIST
    
    We increment the domain's quota on mkdir even when the node already exists.
    This results in a quota inconsistency after live update, where reconstructing
    the tree from scratch results in a different quota.
    
    Not a security issue because the domain uses up quota faster, so it will only
    get a Quota error sooner than it should.
    
    Found by the structured fuzzer.
    
    Signed-off-by: Edwin Török <edvin.torok@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
    (cherry picked from commit c8b96708252a436da44005307f7c195d699bd7c5)
---
 tools/ocaml/xenstored/store.ml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/ocaml/xenstored/store.ml b/tools/ocaml/xenstored/store.ml
index e20767372f..328d3a5198 100644
--- a/tools/ocaml/xenstored/store.ml
+++ b/tools/ocaml/xenstored/store.ml
@@ -421,6 +421,7 @@ let mkdir store perm path =
 	(* It's upt to the mkdir logic to decide what to do with existing path *)
 	if not (existing || (Perms.Connection.is_dom0 perm)) then Quota.check store.quota owner 0;
 	store.root <- path_mkdir store perm path;
+	if not existing then
 	Quota.add_entry store.quota owner
 
 let rm store perm path =
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.12


From xen-changelog-bounces@lists.xenproject.org Fri May 07 09:56:44 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 May 2021 09:56:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.123927.233850 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lexDw-0002NL-Qp; Fri, 07 May 2021 09:56:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 123927.233850; Fri, 07 May 2021 09:56:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lexDw-0002NC-Nv; Fri, 07 May 2021 09:56:44 +0000
Received: by outflank-mailman (input) for mailman id 123927;
 Fri, 07 May 2021 09:56:43 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lexDu-0002Mo-Vm
 for xen-changelog@lists.xenproject.org; Fri, 07 May 2021 09:56:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lexDu-0004cX-Uz
 for xen-changelog@lists.xenproject.org; Fri, 07 May 2021 09:56:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lexDu-0001tV-UB
 for xen-changelog@lists.xenproject.org; Fri, 07 May 2021 09:56:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=EL0Og6GAeCaAJ1KI9hDkQOaU4ofQ7i08fM9RrRTDouI=; b=LKDJfVHKb9xdVmuDW8ACWSs8VZ
	r6LU0+MNi/HaCWpziLLV9lYU/cWfEFLaBmnPDxbp9JyYt/Ck7VitjmphX+JvK0xdkaqxL+IikT0HU
	LABltdbzggVcZVzVojR+LJZagQ5em00FTb75wNUdKLdHgADvwEJYvgCHtG2KNxruy31k=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.12] tools/oxenstored: Reject invalid watch paths early
Message-Id: <E1lexDu-0001tV-UB@xenbits.xenproject.org>
Date: Fri, 07 May 2021 09:56:42 +0000

commit cd5666c62f9eca819eb8d89054023c703d2c9994
Author:     Edwin Török <edvin.torok@citrix.com>
AuthorDate: Fri Jan 15 19:28:37 2021 +0000
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Fri Mar 19 13:46:44 2021 +0000

    tools/oxenstored: Reject invalid watch paths early
    
    Watches on invalid paths were accepted, but they would never trigger.  The
    client also got no notification that its watch is bad and would never trigger.
    
    Found again by the structured fuzzer, due to an error on live update reload:
    the invalid watch paths would get rejected during live update and the list of
    watches would be different pre/post live update.
    
    The testcase is watch on `//`, which is an invalid path.
    
    Signed-off-by: Edwin Török <edvin.torok@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
    (cherry picked from commit dc8caf214fb882546b0e93317b9828247a7c9da8)
---
 tools/ocaml/xenstored/connection.ml  | 5 ++---
 tools/ocaml/xenstored/connections.ml | 4 +++-
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/tools/ocaml/xenstored/connection.ml b/tools/ocaml/xenstored/connection.ml
index 850539e43a..daf8d804f7 100644
--- a/tools/ocaml/xenstored/connection.ml
+++ b/tools/ocaml/xenstored/connection.ml
@@ -158,18 +158,17 @@ let get_children_watches con path =
 let is_dom0 con =
 	Perms.Connection.is_dom0 (get_perm con)
 
-let add_watch con path token =
+let add_watch con (path, apath) token =
 	if !Quota.activate && !Define.maxwatch > 0 &&
 	   not (is_dom0 con) && con.nb_watches > !Define.maxwatch then
 		raise Quota.Limit_reached;
-	let apath = get_watch_path con path in
 	let l = get_watches con apath in
 	if List.exists (fun w -> w.token = token) l then
 		raise Define.Already_exist;
 	let watch = watch_create ~con ~token ~path in
 	Hashtbl.replace con.watches apath (watch :: l);
 	con.nb_watches <- con.nb_watches + 1;
-	apath, watch
+	watch
 
 let del_watch con path token =
 	let apath = get_watch_path con path in
diff --git a/tools/ocaml/xenstored/connections.ml b/tools/ocaml/xenstored/connections.ml
index 1a70d412d5..7efdf3e5e0 100644
--- a/tools/ocaml/xenstored/connections.ml
+++ b/tools/ocaml/xenstored/connections.ml
@@ -114,8 +114,10 @@ let key_of_path path =
 	"" :: Store.Path.to_string_list path
 
 let add_watch cons con path token =
-	let apath, watch = Connection.add_watch con path token in
+	let apath = Connection.get_watch_path con path in
+	(* fail on invalid paths early by calling key_of_str before adding watch *)
 	let key = key_of_str apath in
+	let watch = Connection.add_watch con (path, apath) token in
 	let watches =
  		if Trie.mem cons.watches key
  		then Trie.find cons.watches key
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.12


From xen-changelog-bounces@lists.xenproject.org Fri May 07 09:56:55 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 May 2021 09:56:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.123928.233854 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lexE6-0002QO-Si; Fri, 07 May 2021 09:56:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 123928.233854; Fri, 07 May 2021 09:56:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lexE6-0002QG-PZ; Fri, 07 May 2021 09:56:54 +0000
Received: by outflank-mailman (input) for mailman id 123928;
 Fri, 07 May 2021 09:56:53 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lexE5-0002Pm-59
 for xen-changelog@lists.xenproject.org; Fri, 07 May 2021 09:56:53 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lexE5-0004cj-1d
 for xen-changelog@lists.xenproject.org; Fri, 07 May 2021 09:56:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lexE5-0001u8-0n
 for xen-changelog@lists.xenproject.org; Fri, 07 May 2021 09:56:53 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=RvksobLTDt+04L7IGC3jHN4ToU7u2z2wupqtY4QIT3A=; b=6XUH2D0PM6228/XwIqGKnbAW7Q
	jFUa7dubObX5eDgdkoe9R48d42o1yRmWDoisGpjRwyXcQubqBWjEdgsZcONWzvKd8X/Z+kZaiv/Mg
	rkoIPUdmKKGbK+w0Wp2D7iPdNB6iVruGz9u2r/FyCzeW8w9qiGDnPrYDafEE2W4hhYcU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.12] tools/oxenstored: mkdir conflicts were sometimes missed
Message-Id: <E1lexE5-0001u8-0n@xenbits.xenproject.org>
Date: Fri, 07 May 2021 09:56:53 +0000

commit 955c60401a62bcdd0549bec958eaae4f9f17fb89
Author:     Edwin Török <edvin.torok@citrix.com>
AuthorDate: Fri Jan 15 19:38:58 2021 +0000
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Fri Mar 19 13:46:44 2021 +0000

    tools/oxenstored: mkdir conflicts were sometimes missed
    
    Due to how set_write_lowpath was used here it didn't detect create/delete
    conflicts.  When we create an entry we must mark our parent as modified
    (this is what creating a new node via write does).
    
    Otherwise we can have 2 transactions one creating, and another deleting a node
    both succeeding depending on timing.  Or one transaction reading an entry,
    concluding it doesn't exist, do some other work based on that information and
    successfully commit even if another transaction creates the node via mkdir
    meanwhile.
    
    Signed-off-by: Edwin Török <edvin.torok@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
    (cherry picked from commit 45dee7d92b493bb531e7e77a6f9c0180ab152f87)
---
 tools/ocaml/xenstored/transaction.ml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/ocaml/xenstored/transaction.ml b/tools/ocaml/xenstored/transaction.ml
index 25bc8c3b4a..17b1bdf2ea 100644
--- a/tools/ocaml/xenstored/transaction.ml
+++ b/tools/ocaml/xenstored/transaction.ml
@@ -165,7 +165,7 @@ let write t perm path value =
 
 let mkdir ?(with_watch=true) t perm path =
 	Store.mkdir t.store perm path;
-	set_write_lowpath t path;
+	set_write_lowpath t (Store.Path.get_parent path);
 	if with_watch then
 		add_wop t Xenbus.Xb.Op.Mkdir path
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.12


From xen-changelog-bounces@lists.xenproject.org Fri May 07 09:57:05 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 May 2021 09:57:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.123929.233858 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lexEG-0002U4-UQ; Fri, 07 May 2021 09:57:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 123929.233858; Fri, 07 May 2021 09:57:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lexEG-0002Tw-RH; Fri, 07 May 2021 09:57:04 +0000
Received: by outflank-mailman (input) for mailman id 123929;
 Fri, 07 May 2021 09:57:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lexEF-0002TW-5X
 for xen-changelog@lists.xenproject.org; Fri, 07 May 2021 09:57:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lexEF-0004dA-4i
 for xen-changelog@lists.xenproject.org; Fri, 07 May 2021 09:57:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lexEF-0001us-3n
 for xen-changelog@lists.xenproject.org; Fri, 07 May 2021 09:57:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=53E4cEKVeWXs9ZcRn72O8JlYjJ75PQrt1D6kCnEvcAY=; b=2ReT52yZIt0FHmH0LJ1BCJzsLF
	HCUhyOgCPBP2weMci2tpHu7YmrCRQCw30PH6ihw0x20jYYaAFO6kRN11rloaE4elDVIvgLSPairik
	YEiIbNtha3h/wMXNzYO9DzIA5u/ykdLEXfo4I07S87EjzpJpUDfhb1qKX5WYR2H6u32s=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.12] SUPPORT.MD: Clarify the support state for the Arm SMMUv{1, 2} drivers
Message-Id: <E1lexEF-0001us-3n@xenbits.xenproject.org>
Date: Fri, 07 May 2021 09:57:03 +0000

commit 5b280a59c4dd8dad6cc8da28db981b193d10acee
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Wed Sep 23 09:28:32 2020 +0100
Commit:     Stefano Stabellini <sstabellini@kernel.org>
CommitDate: Fri Mar 19 12:25:19 2021 -0700

    SUPPORT.MD: Clarify the support state for the Arm SMMUv{1, 2} drivers
    
    SMMUv{1, 2} are both marked as security supported, so we would
    technically have to issue an XSA for any IOMMU security bug.
    
    However, at the moment, device passthrough is not security supported
    on Arm and there is no plan to change that in the next few months.
    
    Therefore, mark Arm SMMUv{1, 2} as supported but not security supported.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
    (cherry picked from commit 28804c0ce9fde36feec04ad7f57b2683875da8a0)
---
 SUPPORT.md | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/SUPPORT.md b/SUPPORT.md
index b4038974f9..79ebd51fb8 100644
--- a/SUPPORT.md
+++ b/SUPPORT.md
@@ -62,8 +62,8 @@ supported in this document.
 
     Status, AMD IOMMU: Supported
     Status, Intel VT-d: Supported
-    Status, ARM SMMUv1: Supported
-    Status, ARM SMMUv2: Supported
+    Status, ARM SMMUv1: Supported, not security supported
+    Status, ARM SMMUv2: Supported, not security supported
 
 ### ARM/GICv3 ITS
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.12


From xen-changelog-bounces@lists.xenproject.org Fri May 07 09:57:15 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 May 2021 09:57:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.123931.233862 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lexEQ-0002X0-Vv; Fri, 07 May 2021 09:57:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 123931.233862; Fri, 07 May 2021 09:57:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lexEQ-0002Wt-Sn; Fri, 07 May 2021 09:57:14 +0000
Received: by outflank-mailman (input) for mailman id 123931;
 Fri, 07 May 2021 09:57:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lexEP-0002WQ-8b
 for xen-changelog@lists.xenproject.org; Fri, 07 May 2021 09:57:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lexEP-0004dM-7j
 for xen-changelog@lists.xenproject.org; Fri, 07 May 2021 09:57:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lexEP-0001vl-73
 for xen-changelog@lists.xenproject.org; Fri, 07 May 2021 09:57:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=DJtwZyUQso3mkjjLHr91y7FAMG4xtl+2znfO4ZTsxOM=; b=BRz4SZD9yxLwZVZMO1y+TjyPVc
	btXpbrIuBGIvAlx7Oq2rI0HgPvrj8xhlMZBkTYg6ymVAJFjFIMGDv/WLISEZMVcnjFE3xDOKIIKPl
	ECeIMyIabrjRq9TFzkRxi7fJMwB6tBdK8REGt03zUUOokWe55/rHSKRPTMd+9jbdnWS8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.12] SUPPORT.md: Document speculative attacks status of non-shim 32-bit PV
Message-Id: <E1lexEP-0001vl-73@xenbits.xenproject.org>
Date: Fri, 07 May 2021 09:57:13 +0000

commit 5984905b2638df87a0262d1ee91f0a6e14a86df6
Author:     Ian Jackson <ian.jackson@eu.citrix.com>
AuthorDate: Tue Mar 9 15:00:47 2021 +0000
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue May 4 14:59:44 2021 +0200

    SUPPORT.md: Document speculative attacks status of non-shim 32-bit PV
    
    This documents, but does not fix, XSA-370.
    
    Reported-by: Jann Horn <jannh@google.com>
    Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
    Signed-off-by: George Dunlap <george.dunlap@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 SUPPORT.md | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/SUPPORT.md b/SUPPORT.md
index 79ebd51fb8..19f85cadf6 100644
--- a/SUPPORT.md
+++ b/SUPPORT.md
@@ -79,7 +79,16 @@ Traditional Xen PV guest
 
 No hardware requirements
 
-    Status: Supported
+    Status, x86_64: Supported
+    Status, x86_32, shim: Supported
+    Status, x86_32, without shim: Supported, with caveats
+
+Due to architectural limitations,
+32-bit PV guests must be assumed to be able to read arbitrary host memory
+using speculative execution attacks.
+Advisories will continue to be issued
+for new vulnerabilities related to un-shimmed 32-bit PV guests
+enabling denial-of-service attacks or privilege escalation attacks.
 
 ### x86/HVM
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.12


From xen-changelog-bounces@lists.xenproject.org Fri May 07 18:55:12 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 May 2021 18:55:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.124120.234250 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lf5cv-0008Vm-PZ; Fri, 07 May 2021 18:55:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 124120.234250; Fri, 07 May 2021 18:55:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lf5cv-0008Ve-Ma; Fri, 07 May 2021 18:55:05 +0000
Received: by outflank-mailman (input) for mailman id 124120;
 Fri, 07 May 2021 18:55:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lf5cu-0008VY-RR
 for xen-changelog@lists.xenproject.org; Fri, 07 May 2021 18:55:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lf5cu-0005nV-Qa
 for xen-changelog@lists.xenproject.org; Fri, 07 May 2021 18:55:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lf5cu-0004G9-PZ
 for xen-changelog@lists.xenproject.org; Fri, 07 May 2021 18:55:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=SdqRyyewlW2+Eng1D/OTc5TQTJaXxdhz+E6pSlI/tsM=; b=RH0Vx2R1n8ixc8iPslbWPdjBXf
	3sR0n3WmgjzclrB7lj/BtKMh0kIt/g+jEKALBiO8nzhqpSiuEu7zwz2wE9WSHFnKKCcc2gfWX8nI0
	aNjsxX3oKp8aznVfbJvMGr/sCypZu0EJcUmHlmJhGrhprtQ3eutvIpORGro0uWFUs3R4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools: fix incorrect suggestions for XENCONSOLED_TRACE on BSD
Message-Id: <E1lf5cu-0004G9-PZ@xenbits.xenproject.org>
Date: Fri, 07 May 2021 18:55:04 +0000

commit 27a4986d4fcd6a1bfdac9cafbce1a2f7a58f796e
Author:     Olaf Hering <olaf@aepfle.de>
AuthorDate: Thu May 6 17:17:01 2021 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri May 7 19:50:50 2021 +0100

    tools: fix incorrect suggestions for XENCONSOLED_TRACE on BSD
    
    --log does not take a file, it specifies what is supposed to be logged.
    
    Also separate the XENSTORED and XENCONSOLED variables by a newline.
    
    Signed-off-by: Olaf Hering <olaf@aepfle.de>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 tools/hotplug/FreeBSD/rc.d/xencommons.in | 5 +++--
 tools/hotplug/NetBSD/rc.d/xencommons.in  | 5 +++--
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/tools/hotplug/FreeBSD/rc.d/xencommons.in b/tools/hotplug/FreeBSD/rc.d/xencommons.in
index ccd5a9b055..4c61d8c94e 100644
--- a/tools/hotplug/FreeBSD/rc.d/xencommons.in
+++ b/tools/hotplug/FreeBSD/rc.d/xencommons.in
@@ -21,9 +21,10 @@ status_cmd="xen_status"
 extra_commands="status"
 required_files="/dev/xen/xenstored"
 
-XENSTORED_PIDFILE="@XEN_RUN_DIR@/xenstored.pid"
 XENCONSOLED_PIDFILE="@XEN_RUN_DIR@/xenconsoled.pid"
-#XENCONSOLED_TRACE="@XEN_LOG_DIR@/xenconsole-trace.log"
+#XENCONSOLED_TRACE="none|guest|hv|all"
+
+XENSTORED_PIDFILE="@XEN_RUN_DIR@/xenstored.pid"
 #XENSTORED_TRACE="@XEN_LOG_DIR@/xen/xenstore-trace.log"
 
 load_rc_config $name
diff --git a/tools/hotplug/NetBSD/rc.d/xencommons.in b/tools/hotplug/NetBSD/rc.d/xencommons.in
index 3981787eac..80e518f5de 100644
--- a/tools/hotplug/NetBSD/rc.d/xencommons.in
+++ b/tools/hotplug/NetBSD/rc.d/xencommons.in
@@ -20,9 +20,10 @@ status_cmd="xen_status"
 extra_commands="status"
 required_files="/kern/xen/privcmd"
 
-XENSTORED_PIDFILE="@XEN_RUN_DIR@/xenstored.pid"
 XENCONSOLED_PIDFILE="@XEN_RUN_DIR@/xenconsoled.pid"
-#XENCONSOLED_TRACE="@XEN_LOG_DIR@/xenconsole-trace.log"
+#XENCONSOLED_TRACE="none|guest|hv|all"
+
+XENSTORED_PIDFILE="@XEN_RUN_DIR@/xenstored.pid"
 #XENSTORED_TRACE="@XEN_LOG_DIR@/xenstore-trace.log"
 
 xen_precmd()
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri May 07 18:55:15 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 May 2021 18:55:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.124121.234254 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lf5d5-000064-R5; Fri, 07 May 2021 18:55:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 124121.234254; Fri, 07 May 2021 18:55:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lf5d5-00005w-O7; Fri, 07 May 2021 18:55:15 +0000
Received: by outflank-mailman (input) for mailman id 124121;
 Fri, 07 May 2021 18:55:14 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lf5d4-00005i-US
 for xen-changelog@lists.xenproject.org; Fri, 07 May 2021 18:55:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lf5d4-0005nZ-Ta
 for xen-changelog@lists.xenproject.org; Fri, 07 May 2021 18:55:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lf5d4-0004Gk-Sm
 for xen-changelog@lists.xenproject.org; Fri, 07 May 2021 18:55:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=G3qnLwKIaLei/7+9V8DYlEHKVd7XEwqi8Yxck6xoWmM=; b=KOQY4sihATbSG1CT6Ygfsq0uqk
	WwtbiBTLHdx3eQh2OOM37dEMLwv9vLzs8P64bD7QstXjef/gZg2Ut6jYJdtWZRtIPmhGSbF56GWwc
	4+sCdGg+4nvaFfyDul7Elc/jjkau76y9rbe5nfNwPUT9ToyFXcTyuMz1ZI4iP9G7RO/I=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] docs: Warn about incomplete vtpmmgr TPM 2.0 support
Message-Id: <E1lf5d4-0004Gk-Sm@xenbits.xenproject.org>
Date: Fri, 07 May 2021 18:55:14 +0000

commit 93b2558fae83ab3a6a9b48c851d48ccf57be2298
Author:     Jason Andryuk <jandryuk@gmail.com>
AuthorDate: Thu May 6 09:59:11 2021 -0400
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri May 7 19:50:50 2021 +0100

    docs: Warn about incomplete vtpmmgr TPM 2.0 support
    
    The vtpmmgr TPM 2.0 support is incomplete.  Add a warning about that to
    the documentation so others don't have to work through discovering it is
    broken.
    
    Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Daniel P. Smith <dpsmith@apertussolutions.com>
---
 docs/man/xen-vtpmmgr.7.pod | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/docs/man/xen-vtpmmgr.7.pod b/docs/man/xen-vtpmmgr.7.pod
index af825a7ffe..875dcce508 100644
--- a/docs/man/xen-vtpmmgr.7.pod
+++ b/docs/man/xen-vtpmmgr.7.pod
@@ -222,6 +222,17 @@ XSM label, not the kernel.
 
 =head1 Appendix B: vtpmmgr on TPM 2.0
 
+=head2 WARNING: Incomplete - cannot persist data
+
+TPM 2.0 support for vTPM manager is incomplete.  There is no support for
+persisting an encryption key, so vTPM manager regenerates primary and secondary
+key handles each boot.
+
+Also, the vTPM manger group command implementation hardcodes TPM 1.2 commands.
+This means running manage-vtpmmgr.pl fails when the TPM 2.0 hardware rejects
+the TPM 1.2 commands.  vTPM manager with TPM 2.0 cannot create groups and
+therefore cannot persist vTPM contents.
+
 =head2 Manager disk image setup:
 
 The vTPM Manager requires a disk image to store its encrypted data. The image
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri May 07 18:55:25 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 May 2021 18:55:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.124122.234258 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lf5dF-00008o-Sd; Fri, 07 May 2021 18:55:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 124122.234258; Fri, 07 May 2021 18:55:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lf5dF-00008g-Pi; Fri, 07 May 2021 18:55:25 +0000
Received: by outflank-mailman (input) for mailman id 124122;
 Fri, 07 May 2021 18:55:25 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lf5dF-00008W-1E
 for xen-changelog@lists.xenproject.org; Fri, 07 May 2021 18:55:25 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lf5dF-0005nk-0Q
 for xen-changelog@lists.xenproject.org; Fri, 07 May 2021 18:55:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lf5dE-0004HP-Vo
 for xen-changelog@lists.xenproject.org; Fri, 07 May 2021 18:55:24 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=+ZGzWEJQ9MI/Nv8Q7umOBxkXYddGu1PBAIgNQZQg1nk=; b=eX4E4X3uuPLVvhwOUt+Bka3WlE
	kIryN+nNO027MkEzSy+0w7RFgt9v7OnKEyiWDcbaHx4m45Aryif+jwnaTccRzOnd2NeZkH9GUAfPd
	o72JITWNGCvyTaQL5z7RHvXGy1Eyt4p76ZrpGwoyUQyseZ5qwGrnOeLCDOg6oQxDNx70=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] vtpmmgr: Print error code to aid debugging
Message-Id: <E1lf5dE-0004HP-Vo@xenbits.xenproject.org>
Date: Fri, 07 May 2021 18:55:24 +0000

commit 15a59d6ef3acdd816578eecca7a9247fd38bdf99
Author:     Jason Andryuk <jandryuk@gmail.com>
AuthorDate: Thu May 6 09:59:12 2021 -0400
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri May 7 19:50:50 2021 +0100

    vtpmmgr: Print error code to aid debugging
    
    tpm_get_error_name returns "Unknown Error Code" when an error string
    is not defined.  In that case, we should print the Error Code so it can
    be looked up offline.  tpm_get_error_name returns a const string, so
    just have the two callers always print the error code so it is always
    available.
    
    Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
    Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
    Reviewed-by: Daniel P. Smith <dpsmith@apertussolutions.com>
---
 stubdom/vtpmmgr/tpm.c  | 2 +-
 stubdom/vtpmmgr/tpm2.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/stubdom/vtpmmgr/tpm.c b/stubdom/vtpmmgr/tpm.c
index 779cddd64e..83b2bc16b2 100644
--- a/stubdom/vtpmmgr/tpm.c
+++ b/stubdom/vtpmmgr/tpm.c
@@ -109,7 +109,7 @@
 			UINT32 rsp_status; \
 			UNPACK_OUT(TPM_RSP_HEADER, &rsp_tag, &rsp_len, &rsp_status); \
 			if (rsp_status != TPM_SUCCESS) { \
-				vtpmlogerror(VTPM_LOG_TPM, "Failed with return code %s\n", tpm_get_error_name(rsp_status)); \
+				vtpmlogerror(VTPM_LOG_TPM, "Failed with return code %s (%x)\n", tpm_get_error_name(rsp_status), rsp_status); \
 				status = rsp_status; \
 				goto abort_egress; \
 			} \
diff --git a/stubdom/vtpmmgr/tpm2.c b/stubdom/vtpmmgr/tpm2.c
index c9f1016ab5..655e6d164c 100644
--- a/stubdom/vtpmmgr/tpm2.c
+++ b/stubdom/vtpmmgr/tpm2.c
@@ -126,7 +126,7 @@
     ptr = unpack_TPM_RSP_HEADER(ptr, \
           &(tag), &(paramSize), &(status));\
     if ((status) != TPM_SUCCESS){ \
-        vtpmlogerror(VTPM_LOG_TPM, "Failed with return code %s\n", tpm_get_error_name(status));\
+        vtpmlogerror(VTPM_LOG_TPM, "Failed with return code %s (%x)\n", tpm_get_error_name(status), (status));\
         goto abort_egress;\
     }\
 } while(0)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri May 07 18:55:35 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 May 2021 18:55:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.124123.234262 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lf5dP-0000Cz-US; Fri, 07 May 2021 18:55:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 124123.234262; Fri, 07 May 2021 18:55:35 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lf5dP-0000Cs-RG; Fri, 07 May 2021 18:55:35 +0000
Received: by outflank-mailman (input) for mailman id 124123;
 Fri, 07 May 2021 18:55:35 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lf5dP-0000CQ-4A
 for xen-changelog@lists.xenproject.org; Fri, 07 May 2021 18:55:35 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lf5dP-0005oK-3R
 for xen-changelog@lists.xenproject.org; Fri, 07 May 2021 18:55:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lf5dP-0004I0-2d
 for xen-changelog@lists.xenproject.org; Fri, 07 May 2021 18:55:35 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=6F5N44GM18IDCLv5InRJ0qIIF/yhQf4Ukwq5i5oIuhc=; b=XJbBU3CQHPjeDQpYuMi167ZvF8
	gIEIgWLb7zzyV66rSwTPeAId6KkL+e3MxbuXk7XURyV+9zVpI6da9hrHK/t4lUDfm9FajSaj57zeg
	SBKLdFYM0QQFS3tyMnGLh1HG2bzPZFPxe3ur+LCboYw2t2RwVZwDJ4VsI3iYqTtzjRz8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] stubom: newlib: Enable C99 formats for %z
Message-Id: <E1lf5dP-0004I0-2d@xenbits.xenproject.org>
Date: Fri, 07 May 2021 18:55:35 +0000

commit 244fdf0027b223cc7f402783c1c6084e179e7064
Author:     Jason Andryuk <jandryuk@gmail.com>
AuthorDate: Thu May 6 09:59:13 2021 -0400
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri May 7 19:50:50 2021 +0100

    stubom: newlib: Enable C99 formats for %z
    
    vtpmmgr was changed to print size_t with the %z modifier, but newlib
    isn't compiled with %z support.  So you get output like:
    
    root seal: zu; sector of 13: zu
    root: zu v=zu
    itree: 36; sector of 112: zu
    group: zu v=zu id=zu md=zu
    group seal: zu; 5 in parent: zu; sector of 13: zu
    vtpm: zu+zu; sector of 48: zu
    
    Enable the C99 formats in newlib so vtpmmgr prints the numeric values.
    
    Fixes: 9379af08ccc0 ("stubdom: vtpmmgr: Correctly format size_t with %z when printing.")
    Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
    Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
    Reviewed-by: Daniel P. Smith <dpsmith@apertussolutions.com>
---
 stubdom/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/stubdom/Makefile b/stubdom/Makefile
index 90d9ffcd9f..c6de5f68ae 100644
--- a/stubdom/Makefile
+++ b/stubdom/Makefile
@@ -105,7 +105,7 @@ cross-newlib: $(NEWLIB_STAMPFILE)
 $(NEWLIB_STAMPFILE): mk-headers-$(XEN_TARGET_ARCH) newlib-$(NEWLIB_VERSION)
 	mkdir -p newlib-$(XEN_TARGET_ARCH)
 	( cd newlib-$(XEN_TARGET_ARCH) && \
-	  CC_FOR_TARGET="$(CC) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(NEWLIB_CFLAGS)" AR_FOR_TARGET=$(AR) LD_FOR_TARGET=$(LD) RANLIB_FOR_TARGET=$(RANLIB) ../newlib-$(NEWLIB_VERSION)/configure --prefix=$(CROSS_PREFIX) --verbose --target=$(GNU_TARGET_ARCH)-xen-elf --enable-newlib-io-long-long --disable-multilib && \
+	  CC_FOR_TARGET="$(CC) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(NEWLIB_CFLAGS)" AR_FOR_TARGET=$(AR) LD_FOR_TARGET=$(LD) RANLIB_FOR_TARGET=$(RANLIB) ../newlib-$(NEWLIB_VERSION)/configure --prefix=$(CROSS_PREFIX) --verbose --target=$(GNU_TARGET_ARCH)-xen-elf --enable-newlib-io-long-long --enable-newlib-io-c99-formats --disable-multilib && \
 	  $(MAKE) DESTDIR= && \
 	  $(MAKE) DESTDIR= install )
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri May 07 18:55:46 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 May 2021 18:55:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.124124.234266 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lf5dZ-0000Ie-W2; Fri, 07 May 2021 18:55:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 124124.234266; Fri, 07 May 2021 18:55:45 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lf5dZ-0000IW-T7; Fri, 07 May 2021 18:55:45 +0000
Received: by outflank-mailman (input) for mailman id 124124;
 Fri, 07 May 2021 18:55:45 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lf5dZ-0000IN-78
 for xen-changelog@lists.xenproject.org; Fri, 07 May 2021 18:55:45 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lf5dZ-0005oZ-6R
 for xen-changelog@lists.xenproject.org; Fri, 07 May 2021 18:55:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lf5dZ-0004Ig-5Y
 for xen-changelog@lists.xenproject.org; Fri, 07 May 2021 18:55:45 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=/iQQZgjWH1oeP905chhuART2rfakooonIX9gwHAed2s=; b=pRNPoCdfcEU2muO2b0YiHwJFFQ
	e9jjUQLyIAqwqjTMjQOrJpEQPMnc77IbU6Hn6HhLx+ix4C4SebWY7DiQ0LnRmogen6AO9JVj1tNAI
	RLDo5CRxr5pzL46mkDAfAxI8hL24JSl3svjzL5uwJpLJ5OZHgl6s0Ew4/dWMUBXRNJxc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] vtpmmgr: Move vtpmmgr_shutdown
Message-Id: <E1lf5dZ-0004Ig-5Y@xenbits.xenproject.org>
Date: Fri, 07 May 2021 18:55:45 +0000

commit a7da84c457b05479ab423a2e589c5f46c7da0ed7
Author:     Jason Andryuk <jandryuk@gmail.com>
AuthorDate: Thu May 6 09:59:15 2021 -0400
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri May 7 19:50:50 2021 +0100

    vtpmmgr: Move vtpmmgr_shutdown
    
    Reposition vtpmmgr_shutdown so it can call flush_tpm2 without a forward
    declaration.
    
    Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
    Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
    Reviewed-by: Daniel P. Smith <dpsmith@apertussolutions.com>
---
 stubdom/vtpmmgr/init.c | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/stubdom/vtpmmgr/init.c b/stubdom/vtpmmgr/init.c
index 1506735051..2d314d98e8 100644
--- a/stubdom/vtpmmgr/init.c
+++ b/stubdom/vtpmmgr/init.c
@@ -498,20 +498,6 @@ egress:
    return status;
 }
 
-void vtpmmgr_shutdown(void)
-{
-   /* Cleanup TPM resources */
-   TPM_TerminateHandle(vtpm_globals.oiap.AuthHandle);
-
-   /* Close tpmback */
-   shutdown_tpmback();
-
-   /* Close tpmfront/tpm_tis */
-   close(vtpm_globals.tpm_fd);
-
-   vtpmloginfo(VTPM_LOG_VTPM, "VTPM Manager stopped.\n");
-}
-
 /* TPM 2.0 */
 
 static void tpm2_AuthArea_ctor(const char *authValue, UINT32 authLen,
@@ -788,3 +774,17 @@ abort_egress:
 egress:
     return status;
 }
+
+void vtpmmgr_shutdown(void)
+{
+   /* Cleanup TPM resources */
+   TPM_TerminateHandle(vtpm_globals.oiap.AuthHandle);
+
+   /* Close tpmback */
+   shutdown_tpmback();
+
+   /* Close tpmfront/tpm_tis */
+   close(vtpm_globals.tpm_fd);
+
+   vtpmloginfo(VTPM_LOG_VTPM, "VTPM Manager stopped.\n");
+}
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Sat May 08 07:33:08 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 08 May 2021 07:33:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.124213.234435 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lfHSQ-0002PO-Ix; Sat, 08 May 2021 07:33:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 124213.234435; Sat, 08 May 2021 07:33:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lfHSQ-0002PG-Ft; Sat, 08 May 2021 07:33:02 +0000
Received: by outflank-mailman (input) for mailman id 124213;
 Sat, 08 May 2021 07:33:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lfHSP-0002PA-Vl
 for xen-changelog@lists.xenproject.org; Sat, 08 May 2021 07:33:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lfHSP-0008TZ-R8
 for xen-changelog@lists.xenproject.org; Sat, 08 May 2021 07:33:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lfHSP-000534-Q3
 for xen-changelog@lists.xenproject.org; Sat, 08 May 2021 07:33:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=iv2JAt0nT3qvLldX2Rm/T+y3W8cNxYURGnEkK8NZ3xQ=; b=eLtmnCu13YxUYj8o3xf7spHJDj
	QvdeBz0Epb5yY8epoxYDKKz1pT5numbLXXusYLoLAS0mqhDgfLZWiWhV5kVpF0K3i1oT3sKHSGxqT
	bGBHjw1V/OPxZqfe1zEO7ngHbJcZ24Pi7Ko59lwc9s2/GcItAyfYBkcr9dN09+NtMML4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/vhpet: fix RTC special casing
Message-Id: <E1lfHSP-000534-Q3@xenbits.xenproject.org>
Date: Sat, 08 May 2021 07:33:01 +0000

commit 472a13988a051e5ae84b95815c6caf4378062abe
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Fri May 7 10:43:29 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri May 7 10:43:29 2021 +0200

    x86/vhpet: fix RTC special casing
    
    Restore setting the virtual timer callback private data to NULL if the
    timer is not level triggered. This fixes the special casing done in
    pt_update_irq so that the RTC interrupt when originating from the HPET
    is suspended if the interrupt source is masked.
    
    Note the RTC special casing done in pt_update_irq should only apply to
    the RTC interrupt originating from the emulated RTC device (which does
    set the callback private data), as in that case the callback itself
    will destroy the virtual timer if the interrupt is ignored.
    
    While there also use RTC_IRQ instead of 8 when the HPET is configured
    in LegacyReplacement Mode.
    
    Fixes: be07023be115 ("x86/vhpet: add support for level triggered interrupts")
    Reported-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/hpet.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/hvm/hpet.c b/xen/arch/x86/hvm/hpet.c
index ca94e8b453..ee756abb82 100644
--- a/xen/arch/x86/hvm/hpet.c
+++ b/xen/arch/x86/hvm/hpet.c
@@ -22,6 +22,7 @@
 #include <asm/hvm/trace.h>
 #include <asm/current.h>
 #include <asm/hpet.h>
+#include <asm/mc146818rtc.h>
 #include <xen/sched.h>
 #include <xen/event.h>
 #include <xen/trace.h>
@@ -290,7 +291,7 @@ static void hpet_set_timer(HPETState *h, unsigned int tn,
         /* if LegacyReplacementRoute bit is set, HPET specification requires
            timer0 be routed to IRQ0 in NON-APIC or IRQ2 in the I/O APIC,
            timer1 be routed to IRQ8 in NON-APIC or IRQ8 in the I/O APIC. */
-        irq = (tn == 0) ? 0 : 8;
+        irq = (tn == 0) ? 0 : RTC_IRQ;
         h->pt[tn].source = PTSRC_isa;
     }
     else
@@ -318,7 +319,8 @@ static void hpet_set_timer(HPETState *h, unsigned int tn,
                          hpet_tick_to_ns(h, diff),
                          oneshot ? 0 : hpet_tick_to_ns(h, h->hpet.period[tn]),
                          irq, timer_level(h, tn) ? hpet_timer_fired : NULL,
-                         (void *)(unsigned long)tn, timer_level(h, tn));
+                         timer_level(h, tn) ? (void *)(unsigned long)tn : NULL,
+                         timer_level(h, tn));
 }
 
 static inline uint64_t hpet_fixup_reg(
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat May 08 07:33:12 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 08 May 2021 07:33:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.124214.234439 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lfHSa-0002RE-KR; Sat, 08 May 2021 07:33:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 124214.234439; Sat, 08 May 2021 07:33:12 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lfHSa-0002R6-HV; Sat, 08 May 2021 07:33:12 +0000
Received: by outflank-mailman (input) for mailman id 124214;
 Sat, 08 May 2021 07:33:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lfHSZ-0002Qy-VE
 for xen-changelog@lists.xenproject.org; Sat, 08 May 2021 07:33:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lfHSZ-0008Te-UH
 for xen-changelog@lists.xenproject.org; Sat, 08 May 2021 07:33:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lfHSZ-00053s-TQ
 for xen-changelog@lists.xenproject.org; Sat, 08 May 2021 07:33:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=V3cW8Kb4sv/n34nYfB1DDtbqJBW2G8wC1V2seMbp8p8=; b=ubHj+6xZOWS0rqzQlTn9kMiBZ+
	QlctHzEcunfyGkxyboXnYRTPsBmwVpbyIXqKGrVzvHZNWcyb72jOJL6t7IaLe10dL0FnCu/0Z3vL4
	UMQgMUgk6KgR1VHsJIEpullk/5jaZ6LmSJaNkodLgRlM15wVbvfgSY8DQOu596DlqaI0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] Arm/optee: don't open-code xzalloc_flex_struct()
Message-Id: <E1lfHSZ-00053s-TQ@xenbits.xenproject.org>
Date: Sat, 08 May 2021 07:33:11 +0000

commit 7a2b787880bddbb3bd68b18efe1d6fe339df6ff1
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri May 7 10:45:14 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri May 7 10:45:14 2021 +0200

    Arm/optee: don't open-code xzalloc_flex_struct()
    
    The current use of xzalloc_bytes() in optee is nearly an open-coded
    version  of xzalloc_flex_struct(), which was introduced after the driver
    was merged.
    
    The main difference is xzalloc_bytes() will also force the allocation to
    be SMP_CACHE_BYTES aligned and therefore avoid sharing the cache line.
    While sharing the cache line can have an impact on the performance, this
    is also true for most of the other users of x*alloc(), x*alloc_array(),
    and x*alloc_flex_struct(). So if we want to prevent sharing cache lines,
    arranging for this should be done in the allocator itself.
    
    In this case, we don't need stricter alignment than what the allocator
    provides. Hence replace the call to xzalloc_bytes() with one of
    xzalloc_flex_struct().
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Julien Grall <julien@xen.org>
    Acked-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
---
 xen/arch/arm/tee/optee.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/xen/arch/arm/tee/optee.c b/xen/arch/arm/tee/optee.c
index 9570dc6771..980eebe847 100644
--- a/xen/arch/arm/tee/optee.c
+++ b/xen/arch/arm/tee/optee.c
@@ -529,8 +529,7 @@ static struct optee_shm_buf *allocate_optee_shm_buf(struct optee_domain *ctx,
     while ( unlikely(old != atomic_cmpxchg(&ctx->optee_shm_buf_pages,
                                            old, new)) );
 
-    optee_shm_buf = xzalloc_bytes(sizeof(struct optee_shm_buf) +
-                                  pages_cnt * sizeof(struct page *));
+    optee_shm_buf = xzalloc_flex_struct(struct optee_shm_buf, pages, pages_cnt);
     if ( !optee_shm_buf )
     {
         err_code = -ENOMEM;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun May 09 04:22:10 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 09 May 2021 04:22:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.124490.234825 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lfax9-00059U-KP; Sun, 09 May 2021 04:22:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 124490.234825; Sun, 09 May 2021 04:22:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lfax9-00059L-Gb; Sun, 09 May 2021 04:22:03 +0000
Received: by outflank-mailman (input) for mailman id 124490;
 Sun, 09 May 2021 04:22:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lfax7-00059D-VL
 for xen-changelog@lists.xenproject.org; Sun, 09 May 2021 04:22:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lfax7-0002jN-UU
 for xen-changelog@lists.xenproject.org; Sun, 09 May 2021 04:22:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lfax7-0007aV-TV
 for xen-changelog@lists.xenproject.org; Sun, 09 May 2021 04:22:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=TEgszIJJGP3gXmdo/+YZadKgTA0z3fU31TkkvmP+kJM=; b=LF0iaWG7dZPfcAJKLbmhcr0qJk
	+al6Ss414m5oXZjHDaCtfmWSZp5Cex8kSS+xzDaH7lg3IBZdTMx5Kugt/I875PUjqQ/Qsrl50TLPp
	a9TIaurm2LLgudimsD4bQ2jBx6CjMsTzsau6sy+eLEg5sSzIWGtN0nFWQ6qujWT7fipc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools: fix incorrect suggestions for XENCONSOLED_TRACE on BSD
Message-Id: <E1lfax7-0007aV-TV@xenbits.xenproject.org>
Date: Sun, 09 May 2021 04:22:01 +0000

commit 27a4986d4fcd6a1bfdac9cafbce1a2f7a58f796e
Author:     Olaf Hering <olaf@aepfle.de>
AuthorDate: Thu May 6 17:17:01 2021 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri May 7 19:50:50 2021 +0100

    tools: fix incorrect suggestions for XENCONSOLED_TRACE on BSD
    
    --log does not take a file, it specifies what is supposed to be logged.
    
    Also separate the XENSTORED and XENCONSOLED variables by a newline.
    
    Signed-off-by: Olaf Hering <olaf@aepfle.de>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 tools/hotplug/FreeBSD/rc.d/xencommons.in | 5 +++--
 tools/hotplug/NetBSD/rc.d/xencommons.in  | 5 +++--
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/tools/hotplug/FreeBSD/rc.d/xencommons.in b/tools/hotplug/FreeBSD/rc.d/xencommons.in
index ccd5a9b055..4c61d8c94e 100644
--- a/tools/hotplug/FreeBSD/rc.d/xencommons.in
+++ b/tools/hotplug/FreeBSD/rc.d/xencommons.in
@@ -21,9 +21,10 @@ status_cmd="xen_status"
 extra_commands="status"
 required_files="/dev/xen/xenstored"
 
-XENSTORED_PIDFILE="@XEN_RUN_DIR@/xenstored.pid"
 XENCONSOLED_PIDFILE="@XEN_RUN_DIR@/xenconsoled.pid"
-#XENCONSOLED_TRACE="@XEN_LOG_DIR@/xenconsole-trace.log"
+#XENCONSOLED_TRACE="none|guest|hv|all"
+
+XENSTORED_PIDFILE="@XEN_RUN_DIR@/xenstored.pid"
 #XENSTORED_TRACE="@XEN_LOG_DIR@/xen/xenstore-trace.log"
 
 load_rc_config $name
diff --git a/tools/hotplug/NetBSD/rc.d/xencommons.in b/tools/hotplug/NetBSD/rc.d/xencommons.in
index 3981787eac..80e518f5de 100644
--- a/tools/hotplug/NetBSD/rc.d/xencommons.in
+++ b/tools/hotplug/NetBSD/rc.d/xencommons.in
@@ -20,9 +20,10 @@ status_cmd="xen_status"
 extra_commands="status"
 required_files="/kern/xen/privcmd"
 
-XENSTORED_PIDFILE="@XEN_RUN_DIR@/xenstored.pid"
 XENCONSOLED_PIDFILE="@XEN_RUN_DIR@/xenconsoled.pid"
-#XENCONSOLED_TRACE="@XEN_LOG_DIR@/xenconsole-trace.log"
+#XENCONSOLED_TRACE="none|guest|hv|all"
+
+XENSTORED_PIDFILE="@XEN_RUN_DIR@/xenstored.pid"
 #XENSTORED_TRACE="@XEN_LOG_DIR@/xenstore-trace.log"
 
 xen_precmd()
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun May 09 04:22:13 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 09 May 2021 04:22:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.124491.234828 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lfaxJ-0005Bi-LC; Sun, 09 May 2021 04:22:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 124491.234828; Sun, 09 May 2021 04:22:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lfaxJ-0005BY-I9; Sun, 09 May 2021 04:22:13 +0000
Received: by outflank-mailman (input) for mailman id 124491;
 Sun, 09 May 2021 04:22:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lfaxI-0005BF-21
 for xen-changelog@lists.xenproject.org; Sun, 09 May 2021 04:22:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lfaxI-0002js-16
 for xen-changelog@lists.xenproject.org; Sun, 09 May 2021 04:22:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lfaxI-0007bE-0Q
 for xen-changelog@lists.xenproject.org; Sun, 09 May 2021 04:22:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=2Bx5+oJzq1LURixFycDQEV6oDPThAxJ1MrxgeQ8SD5A=; b=pVhjkboz7QTjdJx7oZhAGeZ82X
	x5F8JukbLglRJfFisOtg3nlUEnK7Y9ckDypWudNu5jfru7EZq/0orNIKVw7Y3Aanev1f8aUDCUda9
	PI8rpJDWNvoRJcjDW31CBNS4OahFp0wifMlJ2/S2BsTJKdSVJNIoq2UsuwgiHyer4GoY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] docs: Warn about incomplete vtpmmgr TPM 2.0 support
Message-Id: <E1lfaxI-0007bE-0Q@xenbits.xenproject.org>
Date: Sun, 09 May 2021 04:22:12 +0000

commit 93b2558fae83ab3a6a9b48c851d48ccf57be2298
Author:     Jason Andryuk <jandryuk@gmail.com>
AuthorDate: Thu May 6 09:59:11 2021 -0400
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri May 7 19:50:50 2021 +0100

    docs: Warn about incomplete vtpmmgr TPM 2.0 support
    
    The vtpmmgr TPM 2.0 support is incomplete.  Add a warning about that to
    the documentation so others don't have to work through discovering it is
    broken.
    
    Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Daniel P. Smith <dpsmith@apertussolutions.com>
---
 docs/man/xen-vtpmmgr.7.pod | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/docs/man/xen-vtpmmgr.7.pod b/docs/man/xen-vtpmmgr.7.pod
index af825a7ffe..875dcce508 100644
--- a/docs/man/xen-vtpmmgr.7.pod
+++ b/docs/man/xen-vtpmmgr.7.pod
@@ -222,6 +222,17 @@ XSM label, not the kernel.
 
 =head1 Appendix B: vtpmmgr on TPM 2.0
 
+=head2 WARNING: Incomplete - cannot persist data
+
+TPM 2.0 support for vTPM manager is incomplete.  There is no support for
+persisting an encryption key, so vTPM manager regenerates primary and secondary
+key handles each boot.
+
+Also, the vTPM manger group command implementation hardcodes TPM 1.2 commands.
+This means running manage-vtpmmgr.pl fails when the TPM 2.0 hardware rejects
+the TPM 1.2 commands.  vTPM manager with TPM 2.0 cannot create groups and
+therefore cannot persist vTPM contents.
+
 =head2 Manager disk image setup:
 
 The vTPM Manager requires a disk image to store its encrypted data. The image
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun May 09 04:22:23 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 09 May 2021 04:22:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.124492.234831 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lfaxT-0005F5-Mg; Sun, 09 May 2021 04:22:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 124492.234831; Sun, 09 May 2021 04:22:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lfaxT-0005Ex-Jg; Sun, 09 May 2021 04:22:23 +0000
Received: by outflank-mailman (input) for mailman id 124492;
 Sun, 09 May 2021 04:22:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lfaxS-0005Ec-5A
 for xen-changelog@lists.xenproject.org; Sun, 09 May 2021 04:22:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lfaxS-0002kD-4L
 for xen-changelog@lists.xenproject.org; Sun, 09 May 2021 04:22:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lfaxS-0007bu-3E
 for xen-changelog@lists.xenproject.org; Sun, 09 May 2021 04:22:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=OTfZV0eFgeRiYSgTyzEw4dHYiSg2p3sCvel8S23SWFM=; b=satj4v/vnI9TlN5VrPDCxF1zNn
	TWioBibKc9Y73tb9cvUteYWIwpBJwcxwNp9p8c9volqUFS1+WVn23lPLTFEbzN+5g00TyHklnz2r2
	KEiEyJ6rt5E99CYBMntrMZcEMCtavIHPBRbsRSLa9y2H8iwf9ZY08Q6XD52YFBcfgn28=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] vtpmmgr: Print error code to aid debugging
Message-Id: <E1lfaxS-0007bu-3E@xenbits.xenproject.org>
Date: Sun, 09 May 2021 04:22:22 +0000

commit 15a59d6ef3acdd816578eecca7a9247fd38bdf99
Author:     Jason Andryuk <jandryuk@gmail.com>
AuthorDate: Thu May 6 09:59:12 2021 -0400
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri May 7 19:50:50 2021 +0100

    vtpmmgr: Print error code to aid debugging
    
    tpm_get_error_name returns "Unknown Error Code" when an error string
    is not defined.  In that case, we should print the Error Code so it can
    be looked up offline.  tpm_get_error_name returns a const string, so
    just have the two callers always print the error code so it is always
    available.
    
    Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
    Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
    Reviewed-by: Daniel P. Smith <dpsmith@apertussolutions.com>
---
 stubdom/vtpmmgr/tpm.c  | 2 +-
 stubdom/vtpmmgr/tpm2.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/stubdom/vtpmmgr/tpm.c b/stubdom/vtpmmgr/tpm.c
index 779cddd64e..83b2bc16b2 100644
--- a/stubdom/vtpmmgr/tpm.c
+++ b/stubdom/vtpmmgr/tpm.c
@@ -109,7 +109,7 @@
 			UINT32 rsp_status; \
 			UNPACK_OUT(TPM_RSP_HEADER, &rsp_tag, &rsp_len, &rsp_status); \
 			if (rsp_status != TPM_SUCCESS) { \
-				vtpmlogerror(VTPM_LOG_TPM, "Failed with return code %s\n", tpm_get_error_name(rsp_status)); \
+				vtpmlogerror(VTPM_LOG_TPM, "Failed with return code %s (%x)\n", tpm_get_error_name(rsp_status), rsp_status); \
 				status = rsp_status; \
 				goto abort_egress; \
 			} \
diff --git a/stubdom/vtpmmgr/tpm2.c b/stubdom/vtpmmgr/tpm2.c
index c9f1016ab5..655e6d164c 100644
--- a/stubdom/vtpmmgr/tpm2.c
+++ b/stubdom/vtpmmgr/tpm2.c
@@ -126,7 +126,7 @@
     ptr = unpack_TPM_RSP_HEADER(ptr, \
           &(tag), &(paramSize), &(status));\
     if ((status) != TPM_SUCCESS){ \
-        vtpmlogerror(VTPM_LOG_TPM, "Failed with return code %s\n", tpm_get_error_name(status));\
+        vtpmlogerror(VTPM_LOG_TPM, "Failed with return code %s (%x)\n", tpm_get_error_name(status), (status));\
         goto abort_egress;\
     }\
 } while(0)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun May 09 04:22:33 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 09 May 2021 04:22:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.124493.234836 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lfaxd-0005IT-On; Sun, 09 May 2021 04:22:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 124493.234836; Sun, 09 May 2021 04:22:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lfaxd-0005IL-LH; Sun, 09 May 2021 04:22:33 +0000
Received: by outflank-mailman (input) for mailman id 124493;
 Sun, 09 May 2021 04:22:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lfaxc-0005I2-8F
 for xen-changelog@lists.xenproject.org; Sun, 09 May 2021 04:22:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lfaxc-0002kV-7T
 for xen-changelog@lists.xenproject.org; Sun, 09 May 2021 04:22:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lfaxc-0007cb-6V
 for xen-changelog@lists.xenproject.org; Sun, 09 May 2021 04:22:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=uaVZ68TY4VCoQaDMsBquBRkW/nL7v52TZdl1Y3gmxfE=; b=phlb+XkhFZGwSjle73iPX20HT9
	jo/FGvSnSKJVz0G7z4UVozbtUDQYJ7vEZYnLO7FT5hbYtqsEQPFY5Y0aR2isWrxaR6iASbJCzIyGY
	CfJ652oMGir6xUPn2Q+AHbsHcFar6Am1yiNPgn+0xfJSyXdoBvr/Hlq3ixNPtyvwTeWY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] stubom: newlib: Enable C99 formats for %z
Message-Id: <E1lfaxc-0007cb-6V@xenbits.xenproject.org>
Date: Sun, 09 May 2021 04:22:32 +0000

commit 244fdf0027b223cc7f402783c1c6084e179e7064
Author:     Jason Andryuk <jandryuk@gmail.com>
AuthorDate: Thu May 6 09:59:13 2021 -0400
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri May 7 19:50:50 2021 +0100

    stubom: newlib: Enable C99 formats for %z
    
    vtpmmgr was changed to print size_t with the %z modifier, but newlib
    isn't compiled with %z support.  So you get output like:
    
    root seal: zu; sector of 13: zu
    root: zu v=zu
    itree: 36; sector of 112: zu
    group: zu v=zu id=zu md=zu
    group seal: zu; 5 in parent: zu; sector of 13: zu
    vtpm: zu+zu; sector of 48: zu
    
    Enable the C99 formats in newlib so vtpmmgr prints the numeric values.
    
    Fixes: 9379af08ccc0 ("stubdom: vtpmmgr: Correctly format size_t with %z when printing.")
    Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
    Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
    Reviewed-by: Daniel P. Smith <dpsmith@apertussolutions.com>
---
 stubdom/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/stubdom/Makefile b/stubdom/Makefile
index 90d9ffcd9f..c6de5f68ae 100644
--- a/stubdom/Makefile
+++ b/stubdom/Makefile
@@ -105,7 +105,7 @@ cross-newlib: $(NEWLIB_STAMPFILE)
 $(NEWLIB_STAMPFILE): mk-headers-$(XEN_TARGET_ARCH) newlib-$(NEWLIB_VERSION)
 	mkdir -p newlib-$(XEN_TARGET_ARCH)
 	( cd newlib-$(XEN_TARGET_ARCH) && \
-	  CC_FOR_TARGET="$(CC) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(NEWLIB_CFLAGS)" AR_FOR_TARGET=$(AR) LD_FOR_TARGET=$(LD) RANLIB_FOR_TARGET=$(RANLIB) ../newlib-$(NEWLIB_VERSION)/configure --prefix=$(CROSS_PREFIX) --verbose --target=$(GNU_TARGET_ARCH)-xen-elf --enable-newlib-io-long-long --disable-multilib && \
+	  CC_FOR_TARGET="$(CC) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(NEWLIB_CFLAGS)" AR_FOR_TARGET=$(AR) LD_FOR_TARGET=$(LD) RANLIB_FOR_TARGET=$(RANLIB) ../newlib-$(NEWLIB_VERSION)/configure --prefix=$(CROSS_PREFIX) --verbose --target=$(GNU_TARGET_ARCH)-xen-elf --enable-newlib-io-long-long --enable-newlib-io-c99-formats --disable-multilib && \
 	  $(MAKE) DESTDIR= && \
 	  $(MAKE) DESTDIR= install )
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun May 09 04:22:43 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 09 May 2021 04:22:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.124494.234840 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lfaxn-0005Lc-QN; Sun, 09 May 2021 04:22:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 124494.234840; Sun, 09 May 2021 04:22:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lfaxn-0005LU-NO; Sun, 09 May 2021 04:22:43 +0000
Received: by outflank-mailman (input) for mailman id 124494;
 Sun, 09 May 2021 04:22:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lfaxm-0005LG-BG
 for xen-changelog@lists.xenproject.org; Sun, 09 May 2021 04:22:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lfaxm-0002kg-AR
 for xen-changelog@lists.xenproject.org; Sun, 09 May 2021 04:22:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lfaxm-0007d7-9Y
 for xen-changelog@lists.xenproject.org; Sun, 09 May 2021 04:22:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=bBgbERTtllSQ9ZzivVr6hEE8t4HgGtgbHDP1h4IgOxg=; b=vHpJwRjwLCaU65aOrv2gt9CNu5
	KYtU2SinO55Brlg5prrAPn3pVJWNUa2Mj0e/6o3y5HEyHu0VeIJm89log295Z8DiNHZsQID1pErse
	4Bl1u2Y3UNVCV4eOH5LZnb9zLdFw3Fi1ICRA73mNiUW/vjAuC16IcOCauQWmCg076lDc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] vtpmmgr: Move vtpmmgr_shutdown
Message-Id: <E1lfaxm-0007d7-9Y@xenbits.xenproject.org>
Date: Sun, 09 May 2021 04:22:42 +0000

commit a7da84c457b05479ab423a2e589c5f46c7da0ed7
Author:     Jason Andryuk <jandryuk@gmail.com>
AuthorDate: Thu May 6 09:59:15 2021 -0400
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri May 7 19:50:50 2021 +0100

    vtpmmgr: Move vtpmmgr_shutdown
    
    Reposition vtpmmgr_shutdown so it can call flush_tpm2 without a forward
    declaration.
    
    Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
    Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
    Reviewed-by: Daniel P. Smith <dpsmith@apertussolutions.com>
---
 stubdom/vtpmmgr/init.c | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/stubdom/vtpmmgr/init.c b/stubdom/vtpmmgr/init.c
index 1506735051..2d314d98e8 100644
--- a/stubdom/vtpmmgr/init.c
+++ b/stubdom/vtpmmgr/init.c
@@ -498,20 +498,6 @@ egress:
    return status;
 }
 
-void vtpmmgr_shutdown(void)
-{
-   /* Cleanup TPM resources */
-   TPM_TerminateHandle(vtpm_globals.oiap.AuthHandle);
-
-   /* Close tpmback */
-   shutdown_tpmback();
-
-   /* Close tpmfront/tpm_tis */
-   close(vtpm_globals.tpm_fd);
-
-   vtpmloginfo(VTPM_LOG_VTPM, "VTPM Manager stopped.\n");
-}
-
 /* TPM 2.0 */
 
 static void tpm2_AuthArea_ctor(const char *authValue, UINT32 authLen,
@@ -788,3 +774,17 @@ abort_egress:
 egress:
     return status;
 }
+
+void vtpmmgr_shutdown(void)
+{
+   /* Cleanup TPM resources */
+   TPM_TerminateHandle(vtpm_globals.oiap.AuthHandle);
+
+   /* Close tpmback */
+   shutdown_tpmback();
+
+   /* Close tpmfront/tpm_tis */
+   close(vtpm_globals.tpm_fd);
+
+   vtpmloginfo(VTPM_LOG_VTPM, "VTPM Manager stopped.\n");
+}
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon May 10 14:33:12 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 10 May 2021 14:33:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.125285.235807 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lg6y3-0001ig-WD; Mon, 10 May 2021 14:33:08 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 125285.235807; Mon, 10 May 2021 14:33:07 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lg6y3-0001iY-Sr; Mon, 10 May 2021 14:33:07 +0000
Received: by outflank-mailman (input) for mailman id 125285;
 Mon, 10 May 2021 14:33:06 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lg6y2-0001i0-EP
 for xen-changelog@lists.xenproject.org; Mon, 10 May 2021 14:33:06 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lg6y2-0006wy-Ah
 for xen-changelog@lists.xenproject.org; Mon, 10 May 2021 14:33:06 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lg6y2-0005Sk-9N
 for xen-changelog@lists.xenproject.org; Mon, 10 May 2021 14:33:06 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=LEM49JtOJ1DYm+mlBR62QU9eSzrZzwQUx55uBYjpsMg=; b=Cg6c3VbWadzvYyktvWJiC3rqqo
	Frlf+o3BXNcLLpKItBIRB8sg1EFYacsksadkKmO6g9H7i+LFl4bMPm+6yrJvPHUPP6Vks4lNF/w7/
	MieKZ0YVOSib9HcjERpAGNicJwfyy4Xsuddw/RcsVJalDgWXBpNZqZtuLJuYvCULE9Z8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] vtpmmgr: Allow specifying srk_handle for TPM2
Message-Id: <E1lg6y2-0005Sk-9N@xenbits.xenproject.org>
Date: Mon, 10 May 2021 14:33:06 +0000

commit 3f1b5080d64d2b66a686133e9f24998a3609d1a3
Author:     Jason Andryuk <jandryuk@gmail.com>
AuthorDate: Thu May 6 09:59:14 2021 -0400
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon May 10 14:48:13 2021 +0100

    vtpmmgr: Allow specifying srk_handle for TPM2
    
    Bypass taking ownership of the TPM2 if an srk_handle is specified.
    
    This srk_handle must be usable with Null auth for the time being.
    
    Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
    Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
    Reviewed-by: Daniel P. Smith <dpsmith@apertussolutions.com>
---
 docs/man/xen-vtpmmgr.7.pod |  7 +++++++
 stubdom/vtpmmgr/init.c     | 11 ++++++++++-
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/docs/man/xen-vtpmmgr.7.pod b/docs/man/xen-vtpmmgr.7.pod
index 875dcce508..3286954568 100644
--- a/docs/man/xen-vtpmmgr.7.pod
+++ b/docs/man/xen-vtpmmgr.7.pod
@@ -92,6 +92,13 @@ Valid arguments:
 
 =over 4
 
+=item srk_handle=<HANDLE>
+
+Specify a srk_handle for TPM 2.0.  TPM 2.0 uses a key hierarchy, and
+this allow specifying the parent handle for vtpmmgr to create its own
+key under.  Using this option bypasses vtpmmgr trying to take ownership
+of the TPM.
+
 =item owner_auth=<AUTHSPEC>
 
 =item srk_auth=<AUTHSPEC>
diff --git a/stubdom/vtpmmgr/init.c b/stubdom/vtpmmgr/init.c
index 2d314d98e8..decf8e8b4d 100644
--- a/stubdom/vtpmmgr/init.c
+++ b/stubdom/vtpmmgr/init.c
@@ -302,6 +302,11 @@ int parse_cmdline_opts(int argc, char** argv, struct Opts* opts)
             goto err_invalid;
          }
       }
+      else if(!strncmp(argv[i], "srk_handle=", 11)) {
+         if(sscanf(argv[i] + 11, "%x", &vtpm_globals.srk_handle) != 1) {
+            goto err_invalid;
+         }
+      }
       else if(!strncmp(argv[i], "tpmdriver=", 10)) {
          if(!strcmp(argv[i] + 10, "tpm_tis")) {
             opts->tpmdriver = TPMDRV_TPM_TIS;
@@ -572,7 +577,11 @@ TPM_RESULT vtpmmgr2_create(void)
 {
     TPM_RESULT status = TPM_SUCCESS;
 
-    TPMTRYRETURN(tpm2_take_ownership());
+    if ( vtpm_globals.srk_handle == 0 ) {
+        TPMTRYRETURN(tpm2_take_ownership());
+    } else {
+        tpm2_AuthArea_ctor(NULL, 0, &vtpm_globals.srk_auth_area);
+    }
 
    /* create SK */
     TPM2_Create_Params_out out;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon May 10 14:33:18 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 10 May 2021 14:33:18 +0000
Received: from list by lists.xenproject.org with outflank-mailman.125286.235811 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lg6yE-0001kc-12; Mon, 10 May 2021 14:33:18 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 125286.235811; Mon, 10 May 2021 14:33:17 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lg6yD-0001kU-US; Mon, 10 May 2021 14:33:17 +0000
Received: by outflank-mailman (input) for mailman id 125286;
 Mon, 10 May 2021 14:33:16 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lg6yC-0001kO-Em
 for xen-changelog@lists.xenproject.org; Mon, 10 May 2021 14:33:16 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lg6yC-0006xP-Dy
 for xen-changelog@lists.xenproject.org; Mon, 10 May 2021 14:33:16 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lg6yC-0005Td-Cw
 for xen-changelog@lists.xenproject.org; Mon, 10 May 2021 14:33:16 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=uQXVWwDGXLqk2Bpb8ICh1QyupyIRujmSbJC7wO3IYQ8=; b=a7cJt9FuJWmy/vIe19xVUy2YNQ
	b9tc91JwZVjRnApmpYB2vynVH+9BLPbg1pEwhaVeeF5vmJ2OBYjUEDVXzl6vTP6uzjpiSvf66nVRT
	D7tNQZoV4bNyyUIkAM/Ev4KbfHyXPL/dfCoa54KJzTuhSewGs5GubckyrZd3gOtLI4ig=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] vtpmmgr: Flush transient keys on shutdown
Message-Id: <E1lg6yC-0005Td-Cw@xenbits.xenproject.org>
Date: Mon, 10 May 2021 14:33:16 +0000

commit ec9596dc534d6869ddcb2fb78a0c5accc91e3f38
Author:     Jason Andryuk <jandryuk@gmail.com>
AuthorDate: Thu May 6 09:59:16 2021 -0400
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon May 10 14:49:00 2021 +0100

    vtpmmgr: Flush transient keys on shutdown
    
    Remove our key so it isn't left in the TPM for someone to come along
    after vtpmmgr shutsdown.
    
    Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
    Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
    Reviewed-by: Daniel P. Smith <dpsmith@apertussolutions.com>
---
 stubdom/vtpmmgr/init.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/stubdom/vtpmmgr/init.c b/stubdom/vtpmmgr/init.c
index decf8e8b4d..56b4be85b3 100644
--- a/stubdom/vtpmmgr/init.c
+++ b/stubdom/vtpmmgr/init.c
@@ -792,6 +792,14 @@ void vtpmmgr_shutdown(void)
    /* Close tpmback */
    shutdown_tpmback();
 
+    if (hw_is_tpm2()) {
+        /* Blow away all stale handles left in the tpm*/
+        if (flush_tpm2() != TPM_SUCCESS) {
+            vtpmlogerror(VTPM_LOG_TPM,
+                         "TPM2_FlushResources failed, continuing shutdown..\n");
+        }
+    }
+
    /* Close tpmfront/tpm_tis */
    close(vtpm_globals.tpm_fd);
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon May 10 14:33:28 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 10 May 2021 14:33:28 +0000
Received: from list by lists.xenproject.org with outflank-mailman.125287.235814 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lg6yO-0001mw-2a; Mon, 10 May 2021 14:33:28 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 125287.235814; Mon, 10 May 2021 14:33:28 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lg6yN-0001mp-Vy; Mon, 10 May 2021 14:33:27 +0000
Received: by outflank-mailman (input) for mailman id 125287;
 Mon, 10 May 2021 14:33:26 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lg6yM-0001mX-Ic
 for xen-changelog@lists.xenproject.org; Mon, 10 May 2021 14:33:26 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lg6yM-0006xZ-H7
 for xen-changelog@lists.xenproject.org; Mon, 10 May 2021 14:33:26 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lg6yM-0005WA-GA
 for xen-changelog@lists.xenproject.org; Mon, 10 May 2021 14:33:26 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=yVqGbWe161pVkNBUWgZVq0ouCY/opBCv/LkocJ5lkEM=; b=njeM3wewC4M4cvQD4EWzfO+t1X
	gqRMste3PzR6BAPVWOd0O/7aBfguXQeHhm2mwTciq2zUzIGZrp7mJEmEY4wKulr0eSLy/vGBwYhOj
	AmKr0PC82D6LWc3E5N+eO+Vv0+mXr2UUhX8th+9BIK0gIrJCmsJ6Q2pLS3/ezpiNkSNw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] vtpmmgr: Flush all transient keys
Message-Id: <E1lg6yM-0005WA-GA@xenbits.xenproject.org>
Date: Mon, 10 May 2021 14:33:26 +0000

commit 746d20b112ace151b19f06bd5e1fb3d695d8982e
Author:     Jason Andryuk <jandryuk@gmail.com>
AuthorDate: Thu May 6 09:59:17 2021 -0400
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon May 10 14:49:01 2021 +0100

    vtpmmgr: Flush all transient keys
    
    We're only flushing 2 transients, but there are 3 handles.  Use <= to also
    flush the third handle since TRANSIENT_LAST is inclusive
    
    The number of transient handles/keys is hardware dependent, so this
    should query for the limit.  And assignment of handles is assumed to be
    sequential from the minimum.  That may not be guaranteed, but seems okay
    with my tpm2.
    
    Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
    Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
    Reviewed-by: Daniel P. Smith <dpsmith@apertussolutions.com>
---
 stubdom/vtpmmgr/init.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/stubdom/vtpmmgr/init.c b/stubdom/vtpmmgr/init.c
index 56b4be85b3..4ae34a4fcb 100644
--- a/stubdom/vtpmmgr/init.c
+++ b/stubdom/vtpmmgr/init.c
@@ -656,7 +656,7 @@ static TPM_RC flush_tpm2(void)
 {
     int i;
 
-    for (i = TRANSIENT_FIRST; i < TRANSIENT_LAST; i++)
+    for (i = TRANSIENT_FIRST; i <= TRANSIENT_LAST; i++)
          TPM2_FlushContext(i);
 
     return TPM_SUCCESS;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon May 10 14:33:38 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 10 May 2021 14:33:38 +0000
Received: from list by lists.xenproject.org with outflank-mailman.125288.235819 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lg6yY-0001r0-4H; Mon, 10 May 2021 14:33:38 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 125288.235819; Mon, 10 May 2021 14:33:38 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lg6yY-0001qt-1O; Mon, 10 May 2021 14:33:38 +0000
Received: by outflank-mailman (input) for mailman id 125288;
 Mon, 10 May 2021 14:33:36 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lg6yW-0001qH-Kv
 for xen-changelog@lists.xenproject.org; Mon, 10 May 2021 14:33:36 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lg6yW-0006xu-K9
 for xen-changelog@lists.xenproject.org; Mon, 10 May 2021 14:33:36 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lg6yW-0005Wx-JI
 for xen-changelog@lists.xenproject.org; Mon, 10 May 2021 14:33:36 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=B8rmxFEtYbN40W2+wzjUoowRWrobghZy0Lidx97tK3k=; b=dCGaiN//i1THV0KHAw2FxosCjr
	riX8hUbgudI/uP2W4FDbB+8Z6v5UkBUN/SkS1hdykhyKYWlFQU5jFy18vnzGGye1sCocHs8iX15EE
	i/DRdgy+2G+5YRdQmKStzUAGaXO2+DLQx+OHTrlR1YMvCpcyBk0IvbeuL12i7LXHxizY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] vtpmmgr: Shutdown more gracefully
Message-Id: <E1lg6yW-0005Wx-JI@xenbits.xenproject.org>
Date: Mon, 10 May 2021 14:33:36 +0000

commit 1b4bfa0b8f6a47c2b80bdc203bb0487fe1bd4366
Author:     Jason Andryuk <jandryuk@gmail.com>
AuthorDate: Thu May 6 09:59:18 2021 -0400
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon May 10 14:49:01 2021 +0100

    vtpmmgr: Shutdown more gracefully
    
    vtpmmgr uses the default, weak app_shutdown, which immediately calls the
    shutdown hypercall.  This short circuits the vtpmmgr clean up logic.  We
    need to perform the clean up to actually Flush our key out of the tpm.
    
    Setting do_shutdown is one step in that direction, but vtpmmgr will most
    likely be waiting in tpmback_req_any.  We need to call shutdown_tpmback
    to cancel the wait inside tpmback and perform the shutdown.
    
    Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
    Reviewed-by: Samuel Thibault <samuel.thibaut@ens-lyon.org>
    Reviewed-by: Daniel P. Smith <dpsmith@apertussolutions.com>
---
 stubdom/vtpmmgr/vtpmmgr.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/stubdom/vtpmmgr/vtpmmgr.c b/stubdom/vtpmmgr/vtpmmgr.c
index 9fddaa24f8..46ea018921 100644
--- a/stubdom/vtpmmgr/vtpmmgr.c
+++ b/stubdom/vtpmmgr/vtpmmgr.c
@@ -67,11 +67,21 @@ int hw_is_tpm2(void)
     return (hardware_version.hw_version == TPM2_HARDWARE) ? 1 : 0;
 }
 
+static int do_shutdown;
+
+void app_shutdown(unsigned int reason)
+{
+    printk("Shutdown requested: %d\n", reason);
+    do_shutdown = 1;
+
+    shutdown_tpmback();
+}
+
 void main_loop(void) {
    tpmcmd_t* tpmcmd;
    uint8_t respbuf[TCPA_MAX_BUFFER_LENGTH];
 
-   while(1) {
+   while (!do_shutdown) {
       /* Wait for requests from a vtpm */
       vtpmloginfo(VTPM_LOG_VTPM, "Waiting for commands from vTPM's:\n");
       if((tpmcmd = tpmback_req_any()) == NULL) {
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon May 10 14:33:48 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 10 May 2021 14:33:48 +0000
Received: from list by lists.xenproject.org with outflank-mailman.125289.235823 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lg6yi-0001yE-6D; Mon, 10 May 2021 14:33:48 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 125289.235823; Mon, 10 May 2021 14:33:48 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lg6yi-0001y6-3G; Mon, 10 May 2021 14:33:48 +0000
Received: by outflank-mailman (input) for mailman id 125289;
 Mon, 10 May 2021 14:33:46 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lg6yg-0001xv-No
 for xen-changelog@lists.xenproject.org; Mon, 10 May 2021 14:33:46 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lg6yg-0006y4-N6
 for xen-changelog@lists.xenproject.org; Mon, 10 May 2021 14:33:46 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lg6yg-0005Xr-MB
 for xen-changelog@lists.xenproject.org; Mon, 10 May 2021 14:33:46 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=LBkU928NV2uDuUSfQBnEgJQuaD/THop2ljG4mBIOE7Q=; b=WijfH8v46aMxNBnOPrPuPzAD/t
	aUPQapH1XI++2HJm19GB1PpOPDGTKzDG4u2ZG9wM8pjp76BLKVGSWx0oEEcYDz8exImHNuYEdvEIK
	xJG3kWB+SuzoiXbuNczzlrFvjYwWSPt3qnBedepGxPLEvyOfcoq+7Gt559d3kK0fritk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] vtpmmgr: Support GetRandom passthrough on TPM 2.0
Message-Id: <E1lg6yg-0005Xr-MB@xenbits.xenproject.org>
Date: Mon, 10 May 2021 14:33:46 +0000

commit 64d00dd126b3dfa4370805f1dc3d7c1ddb6a130d
Author:     Jason Andryuk <jandryuk@gmail.com>
AuthorDate: Thu May 6 09:59:19 2021 -0400
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon May 10 14:50:27 2021 +0100

    vtpmmgr: Support GetRandom passthrough on TPM 2.0
    
    GetRandom passthrough currently fails when using vtpmmgr with a hardware
    TPM 2.0.
    vtpmmgr (8): INFO[VTPM]: Passthrough: TPM_GetRandom
    vtpm (12): vtpm_cmd.c:120: Error: TPM_GetRandom() failed with error code (30)
    
    When running on TPM 2.0 hardware, vtpmmgr needs to convert the TPM 1.2
    TPM_ORD_GetRandom into a TPM2 TPM_CC_GetRandom command.  Besides the
    differing ordinal, the TPM 1.2 uses 32bit sizes for the request and
    response (vs. 16bit for TPM2).
    
    Place the random output directly into the tpmcmd->resp and build the
    packet around it.  This avoids bouncing through an extra buffer, but the
    header has to be written after grabbing the random bytes so we have the
    number of bytes to include in the size.
    
    Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
    Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
    Reviewed by: Daniel P. Smith <dpsmith@apertussolutions.com>
---
 stubdom/vtpmmgr/marshal.h          | 15 ++++++++++
 stubdom/vtpmmgr/vtpm_cmd_handler.c | 61 +++++++++++++++++++++++++++++++++++++-
 2 files changed, 75 insertions(+), 1 deletion(-)

diff --git a/stubdom/vtpmmgr/marshal.h b/stubdom/vtpmmgr/marshal.h
index dce19c6439..f1037a7976 100644
--- a/stubdom/vtpmmgr/marshal.h
+++ b/stubdom/vtpmmgr/marshal.h
@@ -890,6 +890,15 @@ inline int sizeof_TPM_AUTH_SESSION(const TPM_AUTH_SESSION* auth) {
 	return rv;
 }
 
+static
+inline int sizeof_TPM_RQU_HEADER(BYTE* ptr) {
+	int rv = 0;
+	rv += sizeof_UINT16(ptr);
+	rv += sizeof_UINT32(ptr);
+	rv += sizeof_UINT32(ptr);
+	return rv;
+}
+
 static
 inline BYTE* pack_TPM_RQU_HEADER(BYTE* ptr,
 		TPM_TAG tag,
@@ -920,8 +929,14 @@ inline int unpack3_TPM_RQU_HEADER(BYTE* ptr, UINT32* pos, UINT32 max,
 		unpack3_UINT32(ptr, pos, max, ord);
 }
 
+static
+inline int sizeof_TPM_RQU_GetRandom(BYTE* ptr) {
+	return sizeof_TPM_RQU_HEADER(ptr) + sizeof_UINT32(ptr);
+}
+
 #define pack_TPM_RSP_HEADER(p, t, s, r) pack_TPM_RQU_HEADER(p, t, s, r)
 #define unpack_TPM_RSP_HEADER(p, t, s, r) unpack_TPM_RQU_HEADER(p, t, s, r)
 #define unpack3_TPM_RSP_HEADER(p, l, m, t, s, r) unpack3_TPM_RQU_HEADER(p, l, m, t, s, r)
+#define sizeof_TPM_RSP_HEADER(p) sizeof_TPM_RQU_HEADER(p)
 
 #endif
diff --git a/stubdom/vtpmmgr/vtpm_cmd_handler.c b/stubdom/vtpmmgr/vtpm_cmd_handler.c
index 2ac14fae77..c879b24c13 100644
--- a/stubdom/vtpmmgr/vtpm_cmd_handler.c
+++ b/stubdom/vtpmmgr/vtpm_cmd_handler.c
@@ -47,6 +47,7 @@
 #include "vtpm_disk.h"
 #include "vtpmmgr.h"
 #include "tpm.h"
+#include "tpm2.h"
 #include "tpmrsa.h"
 #include "tcg.h"
 #include "mgmt_authority.h"
@@ -772,6 +773,64 @@ static int vtpmmgr_permcheck(struct tpm_opaque *opq)
 	return 1;
 }
 
+TPM_RESULT vtpmmgr_handle_getrandom(struct tpm_opaque *opaque,
+				    tpmcmd_t* tpmcmd)
+{
+	TPM_RESULT status = TPM_SUCCESS;
+	TPM_TAG tag;
+	UINT32 size;
+	const int max_rand_size = TCPA_MAX_BUFFER_LENGTH -
+				  sizeof_TPM_RQU_GetRandom(tpmcmd->req);
+	UINT32 rand_offset;
+	UINT32 rand_size;
+	TPM_COMMAND_CODE ord;
+	BYTE *p;
+
+	if (tpmcmd->req_len != sizeof_TPM_RQU_GetRandom(tpmcmd->req)) {
+		status = TPM_BAD_PARAMETER;
+		tag = TPM_TAG_RQU_COMMAND;
+		goto abort_egress;
+	}
+
+	p = unpack_TPM_RQU_HEADER(tpmcmd->req, &tag, &size, &ord);
+
+	if (!hw_is_tpm2()) {
+		size = TCPA_MAX_BUFFER_LENGTH;
+		TPMTRYRETURN(TPM_TransmitData(tpmcmd->req, tpmcmd->req_len,
+					      tpmcmd->resp, &size));
+		tpmcmd->resp_len = size;
+
+		return TPM_SUCCESS;
+	}
+
+	/* TPM_GetRandom req: <header><uint32 num bytes> */
+	unpack_UINT32(p, &rand_size);
+
+	/* Returning fewer bytes is acceptable per the spec. */
+	if (rand_size > max_rand_size)
+		rand_size = max_rand_size;
+
+	/* Call TPM2_GetRandom but return a TPM_GetRandom response. */
+	/* TPM_GetRandom resp: <header><uint32 num bytes><num random bytes> */
+	rand_offset = sizeof_TPM_RSP_HEADER(tpmcmd->resp) +
+		      sizeof_UINT32(tpmcmd->resp);
+
+	TPMTRYRETURN(TPM2_GetRandom(&rand_size, tpmcmd->resp + rand_offset));
+
+	p = pack_TPM_RSP_HEADER(tpmcmd->resp, TPM_TAG_RSP_COMMAND,
+				rand_offset + rand_size, status);
+	p = pack_UINT32(p, rand_size);
+	tpmcmd->resp_len = rand_offset + rand_size;
+
+	return status;
+
+abort_egress:
+	tpmcmd->resp_len = VTPM_COMMAND_HEADER_SIZE;
+	pack_TPM_RSP_HEADER(tpmcmd->resp, tag + 3, tpmcmd->resp_len, status);
+
+	return status;
+}
+
 TPM_RESULT vtpmmgr_handle_cmd(
 		struct tpm_opaque *opaque,
 		tpmcmd_t* tpmcmd)
@@ -842,7 +901,7 @@ TPM_RESULT vtpmmgr_handle_cmd(
 		switch(ord) {
 		case TPM_ORD_GetRandom:
 			vtpmloginfo(VTPM_LOG_VTPM, "Passthrough: TPM_GetRandom\n");
-			break;
+			return vtpmmgr_handle_getrandom(opaque, tpmcmd);
 		case TPM_ORD_PcrRead:
 			vtpmloginfo(VTPM_LOG_VTPM, "Passthrough: TPM_PcrRead\n");
 			// Quotes also need to be restricted to hide PCR values
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon May 10 14:33:58 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 10 May 2021 14:33:58 +0000
Received: from list by lists.xenproject.org with outflank-mailman.125290.235826 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lg6ys-00020j-7l; Mon, 10 May 2021 14:33:58 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 125290.235826; Mon, 10 May 2021 14:33:58 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lg6ys-00020b-4r; Mon, 10 May 2021 14:33:58 +0000
Received: by outflank-mailman (input) for mailman id 125290;
 Mon, 10 May 2021 14:33:56 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lg6yq-00020Q-Qc
 for xen-changelog@lists.xenproject.org; Mon, 10 May 2021 14:33:56 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lg6yq-0006yF-Pt
 for xen-changelog@lists.xenproject.org; Mon, 10 May 2021 14:33:56 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lg6yq-0005Yc-P6
 for xen-changelog@lists.xenproject.org; Mon, 10 May 2021 14:33:56 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=UG6U/mwaaCZIvOYI5Mh2otbuJgtpBPmbchSZ3si/NNY=; b=Yd71IT0h8IuIpspYkLEWSxPYOD
	qOYyvuE9CxwbDNe0Q/1kS6DFg9/9+1QO6ypZ5ZvAy8suLhFIxep8MAv2oiTFUQonzvdCV8dRYNikI
	qeZ+Zrx7eygSvkfVUsX2e4kg9Z911DT5m9tMblunQqjAJsDCEP2Qmg3lgQ6HRaZeemKA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] vtpmmgr: Remove bogus cast from TPM2_GetRandom
Message-Id: <E1lg6yq-0005Yc-P6@xenbits.xenproject.org>
Date: Mon, 10 May 2021 14:33:56 +0000

commit 7f4276fad8f0bfba5bb3fd012bf2df51c05fcf02
Author:     Jason Andryuk <jandryuk@gmail.com>
AuthorDate: Thu May 6 09:59:20 2021 -0400
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon May 10 14:50:33 2021 +0100

    vtpmmgr: Remove bogus cast from TPM2_GetRandom
    
    The UINT32 <-> UINT16 casting in TPM2_GetRandom is incorrect.  Use a
    local UINT16 as needed for the TPM hardware command and assign the
    result.
    
    Suggested-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
    Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
    Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
    Reviewed-by: Daniel P. Smith <dpsmith@apertussolutions.com>
---
 stubdom/vtpmmgr/tpm2.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/stubdom/vtpmmgr/tpm2.c b/stubdom/vtpmmgr/tpm2.c
index 655e6d164c..ebd06eac74 100644
--- a/stubdom/vtpmmgr/tpm2.c
+++ b/stubdom/vtpmmgr/tpm2.c
@@ -427,15 +427,22 @@ abort_egress:
 
 TPM_RC TPM2_GetRandom(UINT32 * bytesRequested, BYTE * randomBytes)
 {
+    UINT16 bytesReq;
     TPM_BEGIN(TPM_ST_NO_SESSIONS, TPM_CC_GetRandom);
 
-    ptr = pack_UINT16(ptr, (UINT16)*bytesRequested);
+    if (*bytesRequested > UINT16_MAX)
+        bytesReq = UINT16_MAX;
+    else
+        bytesReq = *bytesRequested;
+
+    ptr = pack_UINT16(ptr, bytesReq);
 
     TPM_TRANSMIT();
     TPM_UNPACK_VERIFY();
 
-    ptr = unpack_UINT16(ptr, (UINT16 *)bytesRequested);
-    ptr = unpack_TPM_BUFFER(ptr, randomBytes, *bytesRequested);
+    ptr = unpack_UINT16(ptr, &bytesReq);
+    *bytesRequested = bytesReq;
+    ptr = unpack_TPM_BUFFER(ptr, randomBytes, bytesReq);
 
 abort_egress:
     return status;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon May 10 14:34:08 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 10 May 2021 14:34:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.125291.235831 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lg6z2-00025W-9P; Mon, 10 May 2021 14:34:08 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 125291.235831; Mon, 10 May 2021 14:34:08 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lg6z2-00025O-6M; Mon, 10 May 2021 14:34:08 +0000
Received: by outflank-mailman (input) for mailman id 125291;
 Mon, 10 May 2021 14:34:06 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lg6z0-00024x-Ta
 for xen-changelog@lists.xenproject.org; Mon, 10 May 2021 14:34:06 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lg6z0-0006yd-Sw
 for xen-changelog@lists.xenproject.org; Mon, 10 May 2021 14:34:06 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lg6z0-0005Zj-Rz
 for xen-changelog@lists.xenproject.org; Mon, 10 May 2021 14:34:06 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=VZasWYEmznFGcG7ghy5NC1MFOCm+gOyjQHOcdXNj5RQ=; b=jsfv4C9ZQK650eJVSXuGO5VTMt
	nBcnFNqDnyo8QTz4DuddZnAZF17nnb89FCNRykQs2ap54tuBVWsWeZdfL3NILPpaTZF06m0Q++SMD
	NgZqIhDociAxtHF+9JCh384vTdF0VWsZdHzWqE1JEMvi/T9rCp4HyXMLR98L8F3gxEXg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] vtpmmgr: Fix owner_auth & srk_auth parsing
Message-Id: <E1lg6z0-0005Zj-Rz@xenbits.xenproject.org>
Date: Mon, 10 May 2021 14:34:06 +0000

commit c8d8a1e2e6a1fdba45dd9e9fb993d79d1e5a097c
Author:     Jason Andryuk <jandryuk@gmail.com>
AuthorDate: Thu May 6 09:59:21 2021 -0400
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon May 10 14:50:33 2021 +0100

    vtpmmgr: Fix owner_auth & srk_auth parsing
    
    Argument parsing only matches to before ':' and then the string with
    leading ':' is passed to parse_auth_string which fails to parse.  Extend
    the length to include the seperator in the match.
    
    While here, switch the seperator to "=".  The man page documented "="
    and the other tpm.* arguments already use "=".  Since it didn't work
    before, we don't need to worry about backwards compatibility.
    
    Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
    Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
    Reviewed-by: Daniel P. Smith <dpsmith@apertussolutions.com>
---
 stubdom/vtpmmgr/init.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/stubdom/vtpmmgr/init.c b/stubdom/vtpmmgr/init.c
index 4ae34a4fcb..62dc5994de 100644
--- a/stubdom/vtpmmgr/init.c
+++ b/stubdom/vtpmmgr/init.c
@@ -289,16 +289,16 @@ int parse_cmdline_opts(int argc, char** argv, struct Opts* opts)
    memcpy(vtpm_globals.srk_auth, WELLKNOWN_AUTH, sizeof(TPM_AUTHDATA));
 
    for(i = 1; i < argc; ++i) {
-      if(!strncmp(argv[i], "owner_auth:", 10)) {
-         if((rc = parse_auth_string(argv[i] + 10, vtpm_globals.owner_auth)) < 0) {
+      if(!strncmp(argv[i], "owner_auth=", 11)) {
+         if((rc = parse_auth_string(argv[i] + 11, vtpm_globals.owner_auth)) < 0) {
             goto err_invalid;
          }
          if(rc == 1) {
             opts->gen_owner_auth = 1;
          }
       }
-      else if(!strncmp(argv[i], "srk_auth:", 8)) {
-         if((rc = parse_auth_string(argv[i] + 8, vtpm_globals.srk_auth)) != 0) {
+      else if(!strncmp(argv[i], "srk_auth=", 9)) {
+         if((rc = parse_auth_string(argv[i] + 9, vtpm_globals.srk_auth)) != 0) {
             goto err_invalid;
          }
       }
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon May 10 14:34:18 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 10 May 2021 14:34:18 +0000
Received: from list by lists.xenproject.org with outflank-mailman.125292.235836 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lg6zC-00028u-BP; Mon, 10 May 2021 14:34:18 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 125292.235836; Mon, 10 May 2021 14:34:18 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lg6zC-00028m-7y; Mon, 10 May 2021 14:34:18 +0000
Received: by outflank-mailman (input) for mailman id 125292;
 Mon, 10 May 2021 14:34:17 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lg6zB-00028Z-0V
 for xen-changelog@lists.xenproject.org; Mon, 10 May 2021 14:34:17 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lg6zA-0006z4-W4
 for xen-changelog@lists.xenproject.org; Mon, 10 May 2021 14:34:16 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lg6zA-0005ar-V9
 for xen-changelog@lists.xenproject.org; Mon, 10 May 2021 14:34:16 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=PjB1LMVJgXQnaQ+HcvaHyc8uPYBAHDe4uZzSRLwOJ6M=; b=CcDB244PrzX7R4Hd0YoN34OfB7
	8WcUx9iLz9ymMwtBB2RrHCjEXorSWd0zcK9qD2Z/zvmPFtTQjm7FIBMoDOPRGEbZ4lYu7B7w6tMuB
	Mdr6qoQYzXUgnd/dkfd4Y9o/Khosk6DgDuAMM78XvdF/oh0PW13PZxeDrQMkOkn+o2YE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] vtpmmgr: Check req_len before unpacking command
Message-Id: <E1lg6zA-0005ar-V9@xenbits.xenproject.org>
Date: Mon, 10 May 2021 14:34:16 +0000

commit 5974702bddd37445ae2104f567d88c400227d5d4
Author:     Jason Andryuk <jandryuk@gmail.com>
AuthorDate: Thu May 6 09:59:22 2021 -0400
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon May 10 14:50:33 2021 +0100

    vtpmmgr: Check req_len before unpacking command
    
    vtpm_handle_cmd doesn't ensure there is enough space before unpacking
    the req buffer.  Add a minimum size check.  Called functions will have
    to do their own checking if they need more data from the request.
    
    The error case is tricky since abort_egress wants to rely with a
    corresponding tag.  Just hardcode TPM_TAG_RQU_COMMAND since the vtpm is
    sending in malformed commands in the first place.
    
    Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
    Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
    Reviewed-by: Daniel P. Smith <dpsmith@apertussolutions.com>
---
 stubdom/vtpmmgr/vtpm_cmd_handler.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/stubdom/vtpmmgr/vtpm_cmd_handler.c b/stubdom/vtpmmgr/vtpm_cmd_handler.c
index c879b24c13..5586be6997 100644
--- a/stubdom/vtpmmgr/vtpm_cmd_handler.c
+++ b/stubdom/vtpmmgr/vtpm_cmd_handler.c
@@ -840,6 +840,12 @@ TPM_RESULT vtpmmgr_handle_cmd(
 	UINT32 size;
 	TPM_COMMAND_CODE ord;
 
+	if (tpmcmd->req_len < sizeof_TPM_RQU_HEADER(tpmcmd->req)) {
+		status = TPM_BAD_PARAMETER;
+		tag = TPM_TAG_RQU_COMMAND;
+		goto abort_egress;
+	}
+
 	unpack_TPM_RQU_HEADER(tpmcmd->req,
 			&tag, &size, &ord);
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon May 10 14:34:28 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 10 May 2021 14:34:28 +0000
Received: from list by lists.xenproject.org with outflank-mailman.125293.235838 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lg6zM-0002C6-DT; Mon, 10 May 2021 14:34:28 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 125293.235838; Mon, 10 May 2021 14:34:28 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lg6zM-0002Bw-Af; Mon, 10 May 2021 14:34:28 +0000
Received: by outflank-mailman (input) for mailman id 125293;
 Mon, 10 May 2021 14:34:27 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lg6zL-0002Bm-4T
 for xen-changelog@lists.xenproject.org; Mon, 10 May 2021 14:34:27 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lg6zL-0006zF-3k
 for xen-changelog@lists.xenproject.org; Mon, 10 May 2021 14:34:27 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lg6zL-0005cH-2H
 for xen-changelog@lists.xenproject.org; Mon, 10 May 2021 14:34:27 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=oUpAPHWcZhylnMpNcRDR01bjFFRFBGdq3eVZ73vLPqk=; b=zKO4IC4sKshEh4MG+D4A6oRfBl
	bQ4PF9YT9nhB4s1kuemaAtc/jM7rmgZFWCN2VRoomzkYRQm9//wu5yqd1gYAx4MtJmGqBg3uHBNAX
	gEU0w1eR0vcJ7zjX2YbNsZDuG1tdE71ul5tJaZCr2wLRzYm21DR7Yc4kZudCHrpwNU6M=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] vtpm: Correct timeout units and command duration
Message-Id: <E1lg6zL-0005cH-2H@xenbits.xenproject.org>
Date: Mon, 10 May 2021 14:34:27 +0000

commit fdff034b0710587d8cfe979e7e42c0acd848bc7a
Author:     Jason Andryuk <jandryuk@gmail.com>
AuthorDate: Thu May 6 09:59:23 2021 -0400
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon May 10 14:50:33 2021 +0100

    vtpm: Correct timeout units and command duration
    
    Add two patches:
    vtpm-microsecond-duration.patch fixes the units for timeouts and command
    durations.
    vtpm-command-duration.patch increases the timeout linux uses to allow
    commands to succeed.
    
    Linux works around low timeouts, but not low durations.  The second
    patch allows commands to complete that often timeout with the lower
    command durations.
    
    Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
    Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
    Reviewed-by: Daniel P. Smith <dpsmith@apertussolutions.com>
---
 stubdom/Makefile                        |  2 ++
 stubdom/vtpm-command-duration.patch     | 52 +++++++++++++++++++++++++++++++++
 stubdom/vtpm-microsecond-duration.patch | 52 +++++++++++++++++++++++++++++++++
 3 files changed, 106 insertions(+)

diff --git a/stubdom/Makefile b/stubdom/Makefile
index c6de5f68ae..06aa69d8bc 100644
--- a/stubdom/Makefile
+++ b/stubdom/Makefile
@@ -239,6 +239,8 @@ tpm_emulator-$(XEN_TARGET_ARCH): tpm_emulator-$(TPMEMU_VERSION).tar.gz
 	patch -d $@ -p1 < vtpm-implicit-fallthrough.patch
 	patch -d $@ -p1 < vtpm_TPM_ChangeAuthAsymFinish.patch
 	patch -d $@ -p1 < vtpm_extern.patch
+	patch -d $@ -p1 < vtpm-microsecond-duration.patch
+	patch -d $@ -p1 < vtpm-command-duration.patch
 	mkdir $@/build
 	cd $@/build; CC=${CC} $(CMAKE) .. -DCMAKE_C_FLAGS:STRING="-std=c99 -DTPM_NO_EXTERN $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) -Wno-declaration-after-statement"
 	touch $@
diff --git a/stubdom/vtpm-command-duration.patch b/stubdom/vtpm-command-duration.patch
new file mode 100644
index 0000000000..6fdf2fc9be
--- /dev/null
+++ b/stubdom/vtpm-command-duration.patch
@@ -0,0 +1,52 @@
+From e7c976b5864e7d2649292d90ea60d5aea091a990 Mon Sep 17 00:00:00 2001
+From: Jason Andryuk <jandryuk@gmail.com>
+Date: Sun, 14 Mar 2021 12:46:34 -0400
+Subject: [PATCH 2/2] Increase command durations
+
+Wth Linux 5.4 xen-tpmfront and a Xen vtpm-stubdom, xen-tpmfront was
+failing commands with -ETIME:
+tpm tpm0: tpm_try_transmit: send(): error-62
+
+The vtpm was returning the data, but it was after the duration timeout
+in vtpm_send.  Linux may have started being more stringent about timing?
+
+The vtpm-stubdom has a little delay since it writes its disk before
+returning the response.
+
+Anyway, the durations are rather low.  When they were 1/10/1000 before
+converting to microseconds, Linux showed all three durations rounded to
+10000.  Update them with values from a physical TPM1.2.  These were
+taken from a WEC which was software downgraded from a TPM2 to a TPM1.2.
+They might be excessive, but I'd rather have a command succeed than
+return -ETIME.
+
+An IFX physical TPM1.2 uses:
+1000000
+1500000
+150000000
+
+Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
+---
+ tpm/tpm_data.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/tpm/tpm_data.c b/tpm/tpm_data.c
+index bebaf10..844afca 100644
+--- a/tpm/tpm_data.c
++++ b/tpm/tpm_data.c
+@@ -71,9 +71,9 @@ static void init_timeouts(void)
+   tpmData.permanent.data.tis_timeouts[1] = 2000000;
+   tpmData.permanent.data.tis_timeouts[2] = 750000;
+   tpmData.permanent.data.tis_timeouts[3] = 750000;
+-  tpmData.permanent.data.cmd_durations[0] = 1000;
+-  tpmData.permanent.data.cmd_durations[1] = 10000;
+-  tpmData.permanent.data.cmd_durations[2] = 1000000;
++  tpmData.permanent.data.cmd_durations[0] = 3000000;
++  tpmData.permanent.data.cmd_durations[1] = 3000000;
++  tpmData.permanent.data.cmd_durations[2] = 600000000;
+ }
+ 
+ void tpm_init_data(void)
+-- 
+2.30.2
+
diff --git a/stubdom/vtpm-microsecond-duration.patch b/stubdom/vtpm-microsecond-duration.patch
new file mode 100644
index 0000000000..7a906e72c5
--- /dev/null
+++ b/stubdom/vtpm-microsecond-duration.patch
@@ -0,0 +1,52 @@
+From 5a510e0afd7c288e3f0fb3523ec749ba1366ad61 Mon Sep 17 00:00:00 2001
+From: Jason Andryuk <jandryuk@gmail.com>
+Date: Sun, 14 Mar 2021 12:42:10 -0400
+Subject: [PATCH 1/2] Use microseconds for timeouts and durations
+
+The timeout and duration fields should be in microseconds according to
+the spec.
+
+TPM_CAP_PROP_TIS_TIMEOUT:
+A 4 element array of UINT32 values each denoting the timeout value in
+microseconds for the following in this order:
+
+TPM_CAP_PROP_DURATION:
+A 3 element array of UINT32 values each denoting the duration value in
+microseconds of the duration of the three classes of commands:
+
+Linux will scale the timeouts up by 1000, but not the durations.  Change
+the units for both sets as appropriate.
+
+Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
+---
+ tpm/tpm_data.c | 14 +++++++-------
+ 1 file changed, 7 insertions(+), 7 deletions(-)
+
+diff --git a/tpm/tpm_data.c b/tpm/tpm_data.c
+index a3a79ef..bebaf10 100644
+--- a/tpm/tpm_data.c
++++ b/tpm/tpm_data.c
+@@ -67,13 +67,13 @@ static void init_nv_storage(void)
+ static void init_timeouts(void)
+ {
+   /* for the timeouts we use the PC platform defaults */
+-  tpmData.permanent.data.tis_timeouts[0] = 750;
+-  tpmData.permanent.data.tis_timeouts[1] = 2000;
+-  tpmData.permanent.data.tis_timeouts[2] = 750;
+-  tpmData.permanent.data.tis_timeouts[3] = 750;
+-  tpmData.permanent.data.cmd_durations[0] = 1;
+-  tpmData.permanent.data.cmd_durations[1] = 10;
+-  tpmData.permanent.data.cmd_durations[2] = 1000;
++  tpmData.permanent.data.tis_timeouts[0] = 750000;
++  tpmData.permanent.data.tis_timeouts[1] = 2000000;
++  tpmData.permanent.data.tis_timeouts[2] = 750000;
++  tpmData.permanent.data.tis_timeouts[3] = 750000;
++  tpmData.permanent.data.cmd_durations[0] = 1000;
++  tpmData.permanent.data.cmd_durations[1] = 10000;
++  tpmData.permanent.data.cmd_durations[2] = 1000000;
+ }
+ 
+ void tpm_init_data(void)
+-- 
+2.30.2
+
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon May 10 14:34:39 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 10 May 2021 14:34:39 +0000
Received: from list by lists.xenproject.org with outflank-mailman.125294.235843 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lg6zX-0002FF-F4; Mon, 10 May 2021 14:34:39 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 125294.235843; Mon, 10 May 2021 14:34:39 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lg6zX-0002F6-CA; Mon, 10 May 2021 14:34:39 +0000
Received: by outflank-mailman (input) for mailman id 125294;
 Mon, 10 May 2021 14:34:37 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lg6zV-0002Es-7a
 for xen-changelog@lists.xenproject.org; Mon, 10 May 2021 14:34:37 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lg6zV-0006zQ-6r
 for xen-changelog@lists.xenproject.org; Mon, 10 May 2021 14:34:37 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lg6zV-0005dS-69
 for xen-changelog@lists.xenproject.org; Mon, 10 May 2021 14:34:37 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=n90bxQRO5e3gXgbSFcNPEdix0UoYz8YACyul8jHUWj0=; b=KE7VAk91JX22qnpxDXnw8tAPCq
	bt4CRqcwxYshjG4R31qpMAryFSPveWeokcqH1k2hakDDs/ySl6+z5aj9o4cLfkW1LIoIX0F0XrPfz
	dyOVIff2FmRKQYaepi6tbIeTA080bJQcEEyEcis/OffFbTcg8rv+J8sI00yWLedsKDhY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools: add newlines to xenstored WRL_LOG
Message-Id: <E1lg6zV-0005dS-69@xenbits.xenproject.org>
Date: Mon, 10 May 2021 14:34:37 +0000

commit 982c89ed527bc5b0ffae5da9fd33f9d2d1528f06
Author:     Olaf Hering <olaf@aepfle.de>
AuthorDate: Mon May 3 17:47:12 2021 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon May 10 14:51:52 2021 +0100

    tools: add newlines to xenstored WRL_LOG
    
    According to syslog(3) the fmt string does not need a newline.
    The mini-os implementation of syslog requires the trailing newline.
    Other calls to syslog do include the newline already, add it also to WRL_LOG.
    
    Signed-off-by: Olaf Hering <olaf@aepfle.de>
    Reviewed-by: Juergen Gross <jgross@suse.com>
---
 tools/xenstore/xenstored_domain.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/xenstore/xenstored_domain.c b/tools/xenstore/xenstored_domain.c
index 3d4d0649a2..2d333b3ff6 100644
--- a/tools/xenstore/xenstored_domain.c
+++ b/tools/xenstore/xenstored_domain.c
@@ -1132,10 +1132,10 @@ void wrl_apply_debit_actual(struct domain *domain)
 	if (domain->wrl_credit < 0) {
 		if (!domain->wrl_delay_logged) {
 			domain->wrl_delay_logged = true;
-			WRL_LOG(now, "domain %ld is affected",
+			WRL_LOG(now, "domain %ld is affected\n",
 				(long)domain->domid);
 		} else if (!wrl_log_last_warning) {
-			WRL_LOG(now, "rate limiting restarts");
+			WRL_LOG(now, "rate limiting restarts\n");
 		}
 		wrl_log_last_warning = now.sec;
 	}
@@ -1145,7 +1145,7 @@ void wrl_log_periodic(struct wrl_timestampt now)
 {
 	if (wrl_log_last_warning &&
 	    (now.sec - wrl_log_last_warning) > WRL_LOGEVERY) {
-		WRL_LOG(now, "not in force recently");
+		WRL_LOG(now, "not in force recently\n");
 		wrl_log_last_warning = 0;
 	}
 }
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon May 10 17:22:17 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 10 May 2021 17:22:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.125395.236033 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lg9be-0002Jx-9b; Mon, 10 May 2021 17:22:10 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 125395.236033; Mon, 10 May 2021 17:22:10 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lg9be-0002Jp-6k; Mon, 10 May 2021 17:22:10 +0000
Received: by outflank-mailman (input) for mailman id 125395;
 Mon, 10 May 2021 17:22:09 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lg9bd-0002JT-3Z
 for xen-changelog@lists.xenproject.org; Mon, 10 May 2021 17:22:09 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lg9bd-0001zv-2p
 for xen-changelog@lists.xenproject.org; Mon, 10 May 2021 17:22:09 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lg9bc-0008GM-W2
 for xen-changelog@lists.xenproject.org; Mon, 10 May 2021 17:22:08 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ETmpRQgruRURHMkVUstq6yCOBqdci6IAscHCvQ7EXaw=; b=2/JHloepE4vvfenc+ohgMgUYl2
	NFC/p5F1CW4fyX8kr3svtYB6ed2qpIPHyJsWrXJJbAOOg14qzRsSlinfxKVAF1BpLcVj35WxBKnxD
	q1ji6NAEDA0Xo4pIeu+RbCHYfnDQnWew81qgLA5VLvOvhID3S5JYkLq3fk3oIN4AWrh8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] arm64/vfp: Get rid of READ/WRITE_SYSREG32
Message-Id: <E1lg9bc-0008GM-W2@xenbits.xenproject.org>
Date: Mon, 10 May 2021 17:22:08 +0000

commit 8990f0eaca139364091109389416455f4f78cd65
Author:     Michal Orzel <michal.orzel@arm.com>
AuthorDate: Wed May 5 09:42:59 2021 +0200
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Mon May 10 18:16:34 2021 +0100

    arm64/vfp: Get rid of READ/WRITE_SYSREG32
    
    AArch64 registers are 64bit whereas AArch32 registers
    are 32bit or 64bit. MSR/MRS are expecting 64bit values thus
    we should get rid of helpers READ/WRITE_SYSREG32
    in favour of using READ/WRITE_SYSREG.
    We should also use register_t type when reading sysregs
    which can correspond to uint64_t or uint32_t.
    Even though many AArch64 registers have upper 32bit reserved
    it does not mean that they can't be widen in the future.
    
    Modify type of FPCR, FPSR, FPEXC32_EL2 to register_t.
    
    Signed-off-by: Michal Orzel <michal.orzel@arm.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/arm64/vfp.c        | 12 ++++++------
 xen/include/asm-arm/arm64/vfp.h |  6 +++---
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/xen/arch/arm/arm64/vfp.c b/xen/arch/arm/arm64/vfp.c
index 999a0d58a5..47885e76ba 100644
--- a/xen/arch/arm/arm64/vfp.c
+++ b/xen/arch/arm/arm64/vfp.c
@@ -26,10 +26,10 @@ void vfp_save_state(struct vcpu *v)
                  "stp q30, q31, [%1, #16 * 30]\n\t"
                  : "=Q" (*v->arch.vfp.fpregs) : "r" (v->arch.vfp.fpregs));
 
-    v->arch.vfp.fpsr = READ_SYSREG32(FPSR);
-    v->arch.vfp.fpcr = READ_SYSREG32(FPCR);
+    v->arch.vfp.fpsr = READ_SYSREG(FPSR);
+    v->arch.vfp.fpcr = READ_SYSREG(FPCR);
     if ( is_32bit_domain(v->domain) )
-        v->arch.vfp.fpexc32_el2 = READ_SYSREG32(FPEXC32_EL2);
+        v->arch.vfp.fpexc32_el2 = READ_SYSREG(FPEXC32_EL2);
 }
 
 void vfp_restore_state(struct vcpu *v)
@@ -55,8 +55,8 @@ void vfp_restore_state(struct vcpu *v)
                  "ldp q30, q31, [%1, #16 * 30]\n\t"
                  : : "Q" (*v->arch.vfp.fpregs), "r" (v->arch.vfp.fpregs));
 
-    WRITE_SYSREG32(v->arch.vfp.fpsr, FPSR);
-    WRITE_SYSREG32(v->arch.vfp.fpcr, FPCR);
+    WRITE_SYSREG(v->arch.vfp.fpsr, FPSR);
+    WRITE_SYSREG(v->arch.vfp.fpcr, FPCR);
     if ( is_32bit_domain(v->domain) )
-        WRITE_SYSREG32(v->arch.vfp.fpexc32_el2, FPEXC32_EL2);
+        WRITE_SYSREG(v->arch.vfp.fpexc32_el2, FPEXC32_EL2);
 }
diff --git a/xen/include/asm-arm/arm64/vfp.h b/xen/include/asm-arm/arm64/vfp.h
index 6ab5d36c6c..e6e8c363bc 100644
--- a/xen/include/asm-arm/arm64/vfp.h
+++ b/xen/include/asm-arm/arm64/vfp.h
@@ -7,9 +7,9 @@
 struct vfp_state
 {
     uint64_t fpregs[64] __vfp_aligned;
-    uint32_t fpcr;
-    uint32_t fpexc32_el2;
-    uint32_t fpsr;
+    register_t fpcr;
+    register_t fpexc32_el2;
+    register_t fpsr;
 };
 
 #endif /* _ARM_ARM64_VFP_H */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon May 10 17:22:20 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 10 May 2021 17:22:20 +0000
Received: from list by lists.xenproject.org with outflank-mailman.125396.236036 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lg9bo-0002MN-B3; Mon, 10 May 2021 17:22:20 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 125396.236036; Mon, 10 May 2021 17:22:20 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lg9bo-0002MF-8M; Mon, 10 May 2021 17:22:20 +0000
Received: by outflank-mailman (input) for mailman id 125396;
 Mon, 10 May 2021 17:22:19 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lg9bn-0002M4-BF
 for xen-changelog@lists.xenproject.org; Mon, 10 May 2021 17:22:19 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lg9bn-00020G-AY
 for xen-changelog@lists.xenproject.org; Mon, 10 May 2021 17:22:19 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lg9bn-0008HW-94
 for xen-changelog@lists.xenproject.org; Mon, 10 May 2021 17:22:19 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=pJC1uFxhYkoV86T9XZ/PHDClSkDFH5ehtg3WzLo2G4g=; b=3FAgmAKwFdEXSfjG0ojiWuWoVV
	yyetQ+2H+4+biJwlaHFWm9gw2Z5KgOqjbhHaS902ElkgMwBb8z4atzvMu57AxHHOTy36NzoO1vu5O
	GeQFumOzfyCJlV0BoSQEMBTgGp4n9puV9Tdhd5dloPrAUrPT+DyjmlSPDE2cL0kQWEuY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] arm/domain: Get rid of READ/WRITE_SYSREG32
Message-Id: <E1lg9bn-0008HW-94@xenbits.xenproject.org>
Date: Mon, 10 May 2021 17:22:19 +0000

commit 3fd8336bc599788e5a52a7e63e833b6f03d79fd5
Author:     Michal Orzel <michal.orzel@arm.com>
AuthorDate: Wed May 5 09:43:00 2021 +0200
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Mon May 10 18:16:34 2021 +0100

    arm/domain: Get rid of READ/WRITE_SYSREG32
    
    AArch64 registers are 64bit whereas AArch32 registers
    are 32bit or 64bit. MSR/MRS are expecting 64bit values thus
    we should get rid of helpers READ/WRITE_SYSREG32
    in favour of using READ/WRITE_SYSREG.
    We should also use register_t type when reading sysregs
    which can correspond to uint64_t or uint32_t.
    Even though many AArch64 registers have upper 32bit reserved
    it does not mean that they can't be widen in the future.
    
    Modify type of register cntkctl to register_t.
    
    Thumbee registers are only usable by a 32-bit domain and therefore
    we can just store the bottom 32-bit (IOW there is no type change).
    In fact, this could technically be restricted to Armv7 HW (the
    support was dropped retrospectively in Armv8) but leave it as-is
    for now.
    
    Signed-off-by: Michal Orzel <michal.orzel@arm.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/domain.c        | 18 +++++++++---------
 xen/include/asm-arm/domain.h |  2 +-
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c
index bdd3d3e5b5..621f518b83 100644
--- a/xen/arch/arm/domain.c
+++ b/xen/arch/arm/domain.c
@@ -113,13 +113,13 @@ static void ctxt_switch_from(struct vcpu *p)
     p->arch.tpidr_el1 = READ_SYSREG(TPIDR_EL1);
 
     /* Arch timer */
-    p->arch.cntkctl = READ_SYSREG32(CNTKCTL_EL1);
+    p->arch.cntkctl = READ_SYSREG(CNTKCTL_EL1);
     virt_timer_save(p);
 
     if ( is_32bit_domain(p->domain) && cpu_has_thumbee )
     {
-        p->arch.teecr = READ_SYSREG32(TEECR32_EL1);
-        p->arch.teehbr = READ_SYSREG32(TEEHBR32_EL1);
+        p->arch.teecr = READ_SYSREG(TEECR32_EL1);
+        p->arch.teehbr = READ_SYSREG(TEEHBR32_EL1);
     }
 
 #ifdef CONFIG_ARM_32
@@ -175,7 +175,7 @@ static void ctxt_switch_from(struct vcpu *p)
 
 static void ctxt_switch_to(struct vcpu *n)
 {
-    uint32_t vpidr;
+    register_t vpidr;
 
     /* When the idle VCPU is running, Xen will always stay in hypervisor
      * mode. Therefore we don't need to restore the context of an idle VCPU.
@@ -183,8 +183,8 @@ static void ctxt_switch_to(struct vcpu *n)
     if ( is_idle_vcpu(n) )
         return;
 
-    vpidr = READ_SYSREG32(MIDR_EL1);
-    WRITE_SYSREG32(vpidr, VPIDR_EL2);
+    vpidr = READ_SYSREG(MIDR_EL1);
+    WRITE_SYSREG(vpidr, VPIDR_EL2);
     WRITE_SYSREG(n->arch.vmpidr, VMPIDR_EL2);
 
     /* VGIC */
@@ -257,8 +257,8 @@ static void ctxt_switch_to(struct vcpu *n)
 
     if ( is_32bit_domain(n->domain) && cpu_has_thumbee )
     {
-        WRITE_SYSREG32(n->arch.teecr, TEECR32_EL1);
-        WRITE_SYSREG32(n->arch.teehbr, TEEHBR32_EL1);
+        WRITE_SYSREG(n->arch.teecr, TEECR32_EL1);
+        WRITE_SYSREG(n->arch.teehbr, TEEHBR32_EL1);
     }
 
 #ifdef CONFIG_ARM_32
@@ -274,7 +274,7 @@ static void ctxt_switch_to(struct vcpu *n)
 
     /* This is could trigger an hardware interrupt from the virtual
      * timer. The interrupt needs to be injected into the guest. */
-    WRITE_SYSREG32(n->arch.cntkctl, CNTKCTL_EL1);
+    WRITE_SYSREG(n->arch.cntkctl, CNTKCTL_EL1);
     virt_timer_restore(n);
 }
 
diff --git a/xen/include/asm-arm/domain.h b/xen/include/asm-arm/domain.h
index 0a74df9931..c6b59ee755 100644
--- a/xen/include/asm-arm/domain.h
+++ b/xen/include/asm-arm/domain.h
@@ -190,7 +190,7 @@ struct arch_vcpu
     struct vgic_cpu vgic;
 
     /* Timer registers  */
-    uint32_t cntkctl;
+    register_t cntkctl;
 
     struct vtimer phys_timer;
     struct vtimer virt_timer;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon May 10 17:22:30 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 10 May 2021 17:22:30 +0000
Received: from list by lists.xenproject.org with outflank-mailman.125397.236042 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lg9by-0002Pj-DJ; Mon, 10 May 2021 17:22:30 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 125397.236042; Mon, 10 May 2021 17:22:30 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lg9by-0002Pb-9t; Mon, 10 May 2021 17:22:30 +0000
Received: by outflank-mailman (input) for mailman id 125397;
 Mon, 10 May 2021 17:22:29 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lg9bx-0002PG-Ef
 for xen-changelog@lists.xenproject.org; Mon, 10 May 2021 17:22:29 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lg9bx-00020Y-Dv
 for xen-changelog@lists.xenproject.org; Mon, 10 May 2021 17:22:29 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lg9bx-0008IX-D7
 for xen-changelog@lists.xenproject.org; Mon, 10 May 2021 17:22:29 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=KWYUQXNQ01x4wVA8lFTFQ4rJiuwXH5DYuLSfFge2vmM=; b=l9ey8QGdk48smUsFg0vbqbbcIv
	CINW3/DGCucESjk0P6CrVGWZUZknN0xMvsOTDBiJFM0tXejCtwnuzxuj9Wc64T0XySlKb5+53dlRJ
	NkKXipD3vEdxmH5oYvTg/YLh7jH2ir7QRsJAtKoe/omDVXeeerMerEj7v6iD8oDIo7NU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] arm: Modify type of actlr to register_t
Message-Id: <E1lg9bx-0008IX-D7@xenbits.xenproject.org>
Date: Mon, 10 May 2021 17:22:29 +0000

commit b80470c84553808fef3a6803000ceee8a100e63c
Author:     Michal Orzel <michal.orzel@arm.com>
AuthorDate: Wed May 5 09:43:01 2021 +0200
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Mon May 10 18:16:34 2021 +0100

    arm: Modify type of actlr to register_t
    
    AArch64 registers are 64bit whereas AArch32 registers
    are 32bit or 64bit. MSR/MRS are expecting 64bit values thus
    we should get rid of helpers READ/WRITE_SYSREG32
    in favour of using READ/WRITE_SYSREG.
    We should also use register_t type when reading sysregs
    which can correspond to uint64_t or uint32_t.
    Even though many AArch64 registers have upper 32bit reserved
    it does not mean that they can't be widen in the future.
    
    ACTLR_EL1 system register bits are implementation defined
    which means it is possibly a latent bug on current HW as the CPU
    implementer may already have decided to use the top 32bit.
    
    Signed-off-by: Michal Orzel <michal.orzel@arm.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/domain.c        | 2 +-
 xen/include/asm-arm/domain.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c
index 621f518b83..c021a03c61 100644
--- a/xen/arch/arm/domain.c
+++ b/xen/arch/arm/domain.c
@@ -330,7 +330,7 @@ static void schedule_tail(struct vcpu *prev)
 
 static void continue_new_vcpu(struct vcpu *prev)
 {
-    current->arch.actlr = READ_SYSREG32(ACTLR_EL1);
+    current->arch.actlr = READ_SYSREG(ACTLR_EL1);
     processor_vcpu_initialise(current);
 
     schedule_tail(prev);
diff --git a/xen/include/asm-arm/domain.h b/xen/include/asm-arm/domain.h
index c6b59ee755..2d4f38c669 100644
--- a/xen/include/asm-arm/domain.h
+++ b/xen/include/asm-arm/domain.h
@@ -156,7 +156,7 @@ struct arch_vcpu
 
     /* Control Registers */
     register_t sctlr;
-    uint32_t actlr;
+    register_t actlr;
     uint32_t cpacr;
 
     uint32_t contextidr;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon May 10 17:22:40 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 10 May 2021 17:22:40 +0000
Received: from list by lists.xenproject.org with outflank-mailman.125398.236045 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lg9c8-0002T2-E6; Mon, 10 May 2021 17:22:40 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 125398.236045; Mon, 10 May 2021 17:22:40 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lg9c8-0002Su-BI; Mon, 10 May 2021 17:22:40 +0000
Received: by outflank-mailman (input) for mailman id 125398;
 Mon, 10 May 2021 17:22:39 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lg9c7-0002Sk-HL
 for xen-changelog@lists.xenproject.org; Mon, 10 May 2021 17:22:39 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lg9c7-00020m-Gb
 for xen-changelog@lists.xenproject.org; Mon, 10 May 2021 17:22:39 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lg9c7-0008JM-Fw
 for xen-changelog@lists.xenproject.org; Mon, 10 May 2021 17:22:39 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=v1/H+H4tktMiHikuRXLz3mVTX350o4P2r9R81JThmZc=; b=2qt4cBRd5dZs1Oanzj8gDD2ivw
	czbIUJTdSyfDx064upqZn87pjR/Y0c4rPL7Hc2VAVnmKdqeyrYZ3xJUfvNZUfYww9gnwCnbI4pwUD
	pmKcmaPC8iF2feJZT5za81ONgeYVNqdFo+mlgVuiek0XUqHMPrFq1DwthjmpQSX1bkQg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] arm/gic: Remove member hcr of structure gic_v3
Message-Id: <E1lg9c7-0008JM-Fw@xenbits.xenproject.org>
Date: Mon, 10 May 2021 17:22:39 +0000

commit d55afb1acaffc6047af3cabc3ef4442f313bee2c
Author:     Michal Orzel <michal.orzel@arm.com>
AuthorDate: Wed May 5 09:43:02 2021 +0200
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Mon May 10 18:16:34 2021 +0100

    arm/gic: Remove member hcr of structure gic_v3
    
    ... as it is never used even in the patch introducing it.
    
    Signed-off-by: Michal Orzel <michal.orzel@arm.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/include/asm-arm/gic.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/include/asm-arm/gic.h b/xen/include/asm-arm/gic.h
index ad0f7452d0..5069ab4aac 100644
--- a/xen/include/asm-arm/gic.h
+++ b/xen/include/asm-arm/gic.h
@@ -171,7 +171,7 @@
  * GICv3 registers that needs to be saved/restored
  */
 struct gic_v3 {
-    uint32_t hcr, vmcr, sre_el1;
+    uint32_t vmcr, sre_el1;
     uint32_t apr0[4];
     uint32_t apr1[4];
     uint64_t lr[16];
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon May 10 17:22:50 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 10 May 2021 17:22:50 +0000
Received: from list by lists.xenproject.org with outflank-mailman.125399.236049 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lg9cI-0002W4-FX; Mon, 10 May 2021 17:22:50 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 125399.236049; Mon, 10 May 2021 17:22:50 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lg9cI-0002Vu-Ci; Mon, 10 May 2021 17:22:50 +0000
Received: by outflank-mailman (input) for mailman id 125399;
 Mon, 10 May 2021 17:22:49 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lg9cH-0002Vl-KE
 for xen-changelog@lists.xenproject.org; Mon, 10 May 2021 17:22:49 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lg9cH-000213-JY
 for xen-changelog@lists.xenproject.org; Mon, 10 May 2021 17:22:49 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lg9cH-0008KX-In
 for xen-changelog@lists.xenproject.org; Mon, 10 May 2021 17:22:49 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Dqw50nJ0BiOiZIQ1OTX1EcSZCJ6ZcESBUTHgpLHQjJM=; b=Oosqk1t3q2LP2otx9ZTExORasT
	1JueeQrarCtmwWCox/WBytsGLa/pnECX9BFWrMZ/Y/T9mGEto3xAXSwyflgKaJ3kgX0mxU4N8h3Xa
	hMkZ7/x5KFf7mQAWaMvm4OoVSjTWBUbxJzFMztiYqJKqAUL4LeqBo5mrQnCEEj365W4w=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] arm/gic: Get rid of READ/WRITE_SYSREG32
Message-Id: <E1lg9cH-0008KX-In@xenbits.xenproject.org>
Date: Mon, 10 May 2021 17:22:49 +0000

commit 78e67c99eb3f90c22c8c6ee282ec3a43d2ddccb5
Author:     Michal Orzel <michal.orzel@arm.com>
AuthorDate: Wed May 5 09:43:03 2021 +0200
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Mon May 10 18:16:34 2021 +0100

    arm/gic: Get rid of READ/WRITE_SYSREG32
    
    AArch64 registers are 64bit whereas AArch32 registers
    are 32bit or 64bit. MSR/MRS are expecting 64bit values thus
    we should get rid of helpers READ/WRITE_SYSREG32
    in favour of using READ/WRITE_SYSREG.
    We should also use register_t type when reading sysregs
    which can correspond to uint64_t or uint32_t.
    Even though many AArch64 registers have upper 32bit reserved
    it does not mean that they can't be widen in the future.
    
    Modify types of following members of struct gic_v3 to register_t:
    -vmcr
    -sre_el1
    -apr0
    -apr1
    
    Add new macro GICC_IAR_INTID_MASK containing the mask
    for INTID field of ICC_IAR0/1_EL1 register as only the first 23-bits
    of IAR contains the interrupt number. The rest are RES0.
    Therefore, take the opportunity to mask the bits [23:31] as
    they should be used for an IRQ number (we don't know how the top bits
    will be used).
    
    Signed-off-by: Michal Orzel <michal.orzel@arm.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/gic-v3-lpi.c         |  2 +-
 xen/arch/arm/gic-v3.c             | 98 +++++++++++++++++++++------------------
 xen/include/asm-arm/gic.h         |  6 +--
 xen/include/asm-arm/gic_v3_defs.h |  2 +
 4 files changed, 58 insertions(+), 50 deletions(-)

diff --git a/xen/arch/arm/gic-v3-lpi.c b/xen/arch/arm/gic-v3-lpi.c
index 869bc97fa1..e1594dd20e 100644
--- a/xen/arch/arm/gic-v3-lpi.c
+++ b/xen/arch/arm/gic-v3-lpi.c
@@ -178,7 +178,7 @@ void gicv3_do_LPI(unsigned int lpi)
     irq_enter();
 
     /* EOI the LPI already. */
-    WRITE_SYSREG32(lpi, ICC_EOIR1_EL1);
+    WRITE_SYSREG(lpi, ICC_EOIR1_EL1);
 
     /* Find out if a guest mapped something to this physical LPI. */
     hlpip = gic_get_host_lpi(lpi);
diff --git a/xen/arch/arm/gic-v3.c b/xen/arch/arm/gic-v3.c
index ac28013c19..b86f040589 100644
--- a/xen/arch/arm/gic-v3.c
+++ b/xen/arch/arm/gic-v3.c
@@ -246,12 +246,12 @@ static void gicv3_ich_write_lr(int lr, uint64_t val)
  */
 static void gicv3_enable_sre(void)
 {
-    uint32_t val;
+    register_t val;
 
-    val = READ_SYSREG32(ICC_SRE_EL2);
+    val = READ_SYSREG(ICC_SRE_EL2);
     val |= GICC_SRE_EL2_SRE;
 
-    WRITE_SYSREG32(val, ICC_SRE_EL2);
+    WRITE_SYSREG(val, ICC_SRE_EL2);
     isb();
 }
 
@@ -315,16 +315,16 @@ static void restore_aprn_regs(const union gic_state_data *d)
     switch ( gicv3.nr_priorities )
     {
     case 7:
-        WRITE_SYSREG32(d->v3.apr0[2], ICH_AP0R2_EL2);
-        WRITE_SYSREG32(d->v3.apr1[2], ICH_AP1R2_EL2);
+        WRITE_SYSREG(d->v3.apr0[2], ICH_AP0R2_EL2);
+        WRITE_SYSREG(d->v3.apr1[2], ICH_AP1R2_EL2);
         /* Fall through */
     case 6:
-        WRITE_SYSREG32(d->v3.apr0[1], ICH_AP0R1_EL2);
-        WRITE_SYSREG32(d->v3.apr1[1], ICH_AP1R1_EL2);
+        WRITE_SYSREG(d->v3.apr0[1], ICH_AP0R1_EL2);
+        WRITE_SYSREG(d->v3.apr1[1], ICH_AP1R1_EL2);
         /* Fall through */
     case 5:
-        WRITE_SYSREG32(d->v3.apr0[0], ICH_AP0R0_EL2);
-        WRITE_SYSREG32(d->v3.apr1[0], ICH_AP1R0_EL2);
+        WRITE_SYSREG(d->v3.apr0[0], ICH_AP0R0_EL2);
+        WRITE_SYSREG(d->v3.apr1[0], ICH_AP1R0_EL2);
         break;
     default:
         BUG();
@@ -338,16 +338,16 @@ static void save_aprn_regs(union gic_state_data *d)
     switch ( gicv3.nr_priorities )
     {
     case 7:
-        d->v3.apr0[2] = READ_SYSREG32(ICH_AP0R2_EL2);
-        d->v3.apr1[2] = READ_SYSREG32(ICH_AP1R2_EL2);
+        d->v3.apr0[2] = READ_SYSREG(ICH_AP0R2_EL2);
+        d->v3.apr1[2] = READ_SYSREG(ICH_AP1R2_EL2);
         /* Fall through */
     case 6:
-        d->v3.apr0[1] = READ_SYSREG32(ICH_AP0R1_EL2);
-        d->v3.apr1[1] = READ_SYSREG32(ICH_AP1R1_EL2);
+        d->v3.apr0[1] = READ_SYSREG(ICH_AP0R1_EL2);
+        d->v3.apr1[1] = READ_SYSREG(ICH_AP1R1_EL2);
         /* Fall through */
     case 5:
-        d->v3.apr0[0] = READ_SYSREG32(ICH_AP0R0_EL2);
-        d->v3.apr1[0] = READ_SYSREG32(ICH_AP1R0_EL2);
+        d->v3.apr0[0] = READ_SYSREG(ICH_AP0R0_EL2);
+        d->v3.apr1[0] = READ_SYSREG(ICH_AP1R0_EL2);
         break;
     default:
         BUG();
@@ -371,15 +371,15 @@ static void gicv3_save_state(struct vcpu *v)
     dsb(sy);
     gicv3_save_lrs(v);
     save_aprn_regs(&v->arch.gic);
-    v->arch.gic.v3.vmcr = READ_SYSREG32(ICH_VMCR_EL2);
-    v->arch.gic.v3.sre_el1 = READ_SYSREG32(ICC_SRE_EL1);
+    v->arch.gic.v3.vmcr = READ_SYSREG(ICH_VMCR_EL2);
+    v->arch.gic.v3.sre_el1 = READ_SYSREG(ICC_SRE_EL1);
 }
 
 static void gicv3_restore_state(const struct vcpu *v)
 {
-    uint32_t val;
+    register_t val;
 
-    val = READ_SYSREG32(ICC_SRE_EL2);
+    val = READ_SYSREG(ICC_SRE_EL2);
     /*
      * Don't give access to system registers when the guest is using
      * GICv2
@@ -388,7 +388,7 @@ static void gicv3_restore_state(const struct vcpu *v)
         val &= ~GICC_SRE_EL2_ENEL1;
     else
         val |= GICC_SRE_EL2_ENEL1;
-    WRITE_SYSREG32(val, ICC_SRE_EL2);
+    WRITE_SYSREG(val, ICC_SRE_EL2);
 
     /*
      * VFIQEn is RES1 if ICC_SRE_EL1.SRE is 1. This causes a Group0
@@ -398,9 +398,9 @@ static void gicv3_restore_state(const struct vcpu *v)
      * want before starting to mess with the rest of the GIC, and
      * VMCR_EL1 in particular.
      */
-    WRITE_SYSREG32(v->arch.gic.v3.sre_el1, ICC_SRE_EL1);
+    WRITE_SYSREG(v->arch.gic.v3.sre_el1, ICC_SRE_EL1);
     isb();
-    WRITE_SYSREG32(v->arch.gic.v3.vmcr, ICH_VMCR_EL2);
+    WRITE_SYSREG(v->arch.gic.v3.vmcr, ICH_VMCR_EL2);
     restore_aprn_regs(&v->arch.gic);
     gicv3_restore_lrs(v);
 
@@ -468,24 +468,25 @@ static void gicv3_mask_irq(struct irq_desc *irqd)
 static void gicv3_eoi_irq(struct irq_desc *irqd)
 {
     /* Lower the priority */
-    WRITE_SYSREG32(irqd->irq, ICC_EOIR1_EL1);
+    WRITE_SYSREG(irqd->irq, ICC_EOIR1_EL1);
     isb();
 }
 
 static void gicv3_dir_irq(struct irq_desc *irqd)
 {
     /* Deactivate */
-    WRITE_SYSREG32(irqd->irq, ICC_DIR_EL1);
+    WRITE_SYSREG(irqd->irq, ICC_DIR_EL1);
     isb();
 }
 
 static unsigned int gicv3_read_irq(void)
 {
-    unsigned int irq = READ_SYSREG32(ICC_IAR1_EL1);
+    register_t irq = READ_SYSREG(ICC_IAR1_EL1);
 
     dsb(sy);
 
-    return irq;
+    /* IRQs are encoded using 23bit. */
+    return (irq & GICC_IAR_INTID_MASK);
 }
 
 /*
@@ -857,16 +858,16 @@ static int gicv3_cpu_init(void)
     gicv3_enable_sre();
 
     /* No priority grouping */
-    WRITE_SYSREG32(0, ICC_BPR1_EL1);
+    WRITE_SYSREG(0, ICC_BPR1_EL1);
 
     /* Set priority mask register */
-    WRITE_SYSREG32(DEFAULT_PMR_VALUE, ICC_PMR_EL1);
+    WRITE_SYSREG(DEFAULT_PMR_VALUE, ICC_PMR_EL1);
 
     /* EOI drops priority, DIR deactivates the interrupt (mode 1) */
-    WRITE_SYSREG32(GICC_CTLR_EL1_EOImode_drop, ICC_CTLR_EL1);
+    WRITE_SYSREG(GICC_CTLR_EL1_EOImode_drop, ICC_CTLR_EL1);
 
     /* Enable Group1 interrupts */
-    WRITE_SYSREG32(1, ICC_IGRPEN1_EL1);
+    WRITE_SYSREG(1, ICC_IGRPEN1_EL1);
 
     /* Sync at once at the end of cpu interface configuration */
     isb();
@@ -876,15 +877,15 @@ static int gicv3_cpu_init(void)
 
 static void gicv3_cpu_disable(void)
 {
-    WRITE_SYSREG32(0, ICC_CTLR_EL1);
+    WRITE_SYSREG(0, ICC_CTLR_EL1);
     isb();
 }
 
 static void gicv3_hyp_init(void)
 {
-    uint32_t vtr;
+    register_t vtr;
 
-    vtr = READ_SYSREG32(ICH_VTR_EL2);
+    vtr = READ_SYSREG(ICH_VTR_EL2);
     gicv3_info.nr_lrs  = (vtr & ICH_VTR_NRLRGS) + 1;
     gicv3.nr_priorities = ((vtr >> ICH_VTR_PRIBITS_SHIFT) &
                           ICH_VTR_PRIBITS_MASK) + 1;
@@ -892,8 +893,8 @@ static void gicv3_hyp_init(void)
     if ( !((gicv3.nr_priorities > 4) && (gicv3.nr_priorities < 8)) )
         panic("GICv3: Invalid number of priority bits\n");
 
-    WRITE_SYSREG32(ICH_VMCR_EOI | ICH_VMCR_VENG1, ICH_VMCR_EL2);
-    WRITE_SYSREG32(GICH_HCR_EN, ICH_HCR_EL2);
+    WRITE_SYSREG(ICH_VMCR_EOI | ICH_VMCR_VENG1, ICH_VMCR_EL2);
+    WRITE_SYSREG(GICH_HCR_EN, ICH_HCR_EL2);
 }
 
 /* Set up the per-CPU parts of the GIC for a secondary CPU */
@@ -917,11 +918,11 @@ out:
 
 static void gicv3_hyp_disable(void)
 {
-    uint32_t hcr;
+    register_t hcr;
 
-    hcr = READ_SYSREG32(ICH_HCR_EL2);
+    hcr = READ_SYSREG(ICH_HCR_EL2);
     hcr &= ~GICH_HCR_EN;
-    WRITE_SYSREG32(hcr, ICH_HCR_EL2);
+    WRITE_SYSREG(hcr, ICH_HCR_EL2);
     isb();
 }
 
@@ -1140,39 +1141,44 @@ static void gicv3_write_lr(int lr_reg, const struct gic_lr *lr)
 
 static void gicv3_hcr_status(uint32_t flag, bool status)
 {
-    uint32_t hcr;
+    register_t hcr;
 
-    hcr = READ_SYSREG32(ICH_HCR_EL2);
+    hcr = READ_SYSREG(ICH_HCR_EL2);
     if ( status )
-        WRITE_SYSREG32(hcr | flag, ICH_HCR_EL2);
+        WRITE_SYSREG(hcr | flag, ICH_HCR_EL2);
     else
-        WRITE_SYSREG32(hcr & (~flag), ICH_HCR_EL2);
+        WRITE_SYSREG(hcr & (~flag), ICH_HCR_EL2);
     isb();
 }
 
 static unsigned int gicv3_read_vmcr_priority(void)
 {
-   return ((READ_SYSREG32(ICH_VMCR_EL2) >> ICH_VMCR_PRIORITY_SHIFT) &
+   return ((READ_SYSREG(ICH_VMCR_EL2) >> ICH_VMCR_PRIORITY_SHIFT) &
             ICH_VMCR_PRIORITY_MASK);
 }
 
 /* Only support reading GRP1 APRn registers */
 static unsigned int gicv3_read_apr(int apr_reg)
 {
+    register_t apr;
+
     switch ( apr_reg )
     {
     case 0:
         ASSERT(gicv3.nr_priorities > 4 && gicv3.nr_priorities < 8);
-        return READ_SYSREG32(ICH_AP1R0_EL2);
+        apr = READ_SYSREG(ICH_AP1R0_EL2);
     case 1:
         ASSERT(gicv3.nr_priorities > 5 && gicv3.nr_priorities < 8);
-        return READ_SYSREG32(ICH_AP1R1_EL2);
+        apr = READ_SYSREG(ICH_AP1R1_EL2);
     case 2:
         ASSERT(gicv3.nr_priorities > 6 && gicv3.nr_priorities < 8);
-        return READ_SYSREG32(ICH_AP1R2_EL2);
+        apr = READ_SYSREG(ICH_AP1R2_EL2);
     default:
         BUG();
     }
+
+    /* Number of priority levels do not exceed 32bit. */
+    return apr;
 }
 
 static bool gicv3_read_pending_state(struct irq_desc *irqd)
diff --git a/xen/include/asm-arm/gic.h b/xen/include/asm-arm/gic.h
index 5069ab4aac..c7f0c343d1 100644
--- a/xen/include/asm-arm/gic.h
+++ b/xen/include/asm-arm/gic.h
@@ -171,9 +171,9 @@
  * GICv3 registers that needs to be saved/restored
  */
 struct gic_v3 {
-    uint32_t vmcr, sre_el1;
-    uint32_t apr0[4];
-    uint32_t apr1[4];
+    register_t vmcr, sre_el1;
+    register_t apr0[4];
+    register_t apr1[4];
     uint64_t lr[16];
 };
 #endif
diff --git a/xen/include/asm-arm/gic_v3_defs.h b/xen/include/asm-arm/gic_v3_defs.h
index 5a578e7c11..34ed5f857d 100644
--- a/xen/include/asm-arm/gic_v3_defs.h
+++ b/xen/include/asm-arm/gic_v3_defs.h
@@ -45,6 +45,8 @@
 #define GICC_SRE_EL2_DIB             (1UL << 2)
 #define GICC_SRE_EL2_ENEL1           (1UL << 3)
 
+#define GICC_IAR_INTID_MASK          (0xFFFFFF)
+
 /* Additional bits in GICD_TYPER defined by GICv3 */
 #define GICD_TYPE_ID_BITS_SHIFT 19
 #define GICD_TYPE_ID_BITS(r)    ((((r) >> GICD_TYPE_ID_BITS_SHIFT) & 0x1f) + 1)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon May 10 17:23:01 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 10 May 2021 17:23:01 +0000
Received: from list by lists.xenproject.org with outflank-mailman.125400.236052 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lg9cT-0002Zp-IQ; Mon, 10 May 2021 17:23:01 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 125400.236052; Mon, 10 May 2021 17:23:01 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lg9cT-0002Zh-FY; Mon, 10 May 2021 17:23:01 +0000
Received: by outflank-mailman (input) for mailman id 125400;
 Mon, 10 May 2021 17:22:59 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lg9cR-0002ZI-NN
 for xen-changelog@lists.xenproject.org; Mon, 10 May 2021 17:22:59 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lg9cR-00021H-Mf
 for xen-changelog@lists.xenproject.org; Mon, 10 May 2021 17:22:59 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lg9cR-0008LR-Ls
 for xen-changelog@lists.xenproject.org; Mon, 10 May 2021 17:22:59 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=DmY9dqp/epRaJ28TioQcrW6ucQSAB9m+Xk+MMR4oTUQ=; b=YitEWbdg6aaSstrinepxiA84hL
	kyjxfA4G4tO1anqerGQZxZjKupS+fcQzWkC7TFoT+bMw2vvhSTEzbJSmcHk4ByTcNYxvn52ZwYdsC
	F2KQQARNT+jtrHR0riSj0B374X5hWolxN1YGDKlUxi5Br+6VI3seJO7rTpLA5449H+qI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] arm/p2m: Get rid of READ/WRITE_SYSREG32
Message-Id: <E1lg9cR-0008LR-Ls@xenbits.xenproject.org>
Date: Mon, 10 May 2021 17:22:59 +0000

commit 8eb7cc0465fa228064e807aad51eb7428d6d3199
Author:     Michal Orzel <michal.orzel@arm.com>
AuthorDate: Wed May 5 09:43:04 2021 +0200
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Mon May 10 18:16:34 2021 +0100

    arm/p2m: Get rid of READ/WRITE_SYSREG32
    
    AArch64 registers are 64bit whereas AArch32 registers
    are 32bit or 64bit. MSR/MRS are expecting 64bit values thus
    we should get rid of helpers READ/WRITE_SYSREG32
    in favour of using READ/WRITE_SYSREG.
    We should also use register_t type when reading sysregs
    which can correspond to uint64_t or uint32_t.
    Even though many AArch64 registers have upper 32bit reserved
    it does not mean that they can't be widen in the future.
    
    Modify type of vtcr to register_t.
    
    Signed-off-by: Michal Orzel <michal.orzel@arm.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/p2m.c   | 8 ++++----
 xen/arch/arm/traps.c | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c
index ac50312620..d414c4feb9 100644
--- a/xen/arch/arm/p2m.c
+++ b/xen/arch/arm/p2m.c
@@ -1973,11 +1973,11 @@ void __init p2m_restrict_ipa_bits(unsigned int ipa_bits)
 }
 
 /* VTCR value to be configured by all CPUs. Set only once by the boot CPU */
-static uint32_t __read_mostly vtcr;
+static register_t __read_mostly vtcr;
 
 static void setup_virt_paging_one(void *data)
 {
-    WRITE_SYSREG32(vtcr, VTCR_EL2);
+    WRITE_SYSREG(vtcr, VTCR_EL2);
 
     /*
      * ARM64_WORKAROUND_AT_SPECULATE: We want to keep the TLBs free from
@@ -2000,7 +2000,7 @@ static void setup_virt_paging_one(void *data)
 void __init setup_virt_paging(void)
 {
     /* Setup Stage 2 address translation */
-    unsigned long val = VTCR_RES1|VTCR_SH0_IS|VTCR_ORGN0_WBWA|VTCR_IRGN0_WBWA;
+    register_t val = VTCR_RES1|VTCR_SH0_IS|VTCR_ORGN0_WBWA|VTCR_IRGN0_WBWA;
 
 #ifdef CONFIG_ARM_32
     if ( p2m_ipa_bits < 40 )
@@ -2089,7 +2089,7 @@ void __init setup_virt_paging(void)
            pa_range_info[pa_range].pabits,
            ( MAX_VMID == MAX_VMID_16_BIT ) ? 16 : 8);
 #endif
-    printk("P2M: %d levels with order-%d root, VTCR 0x%lx\n",
+    printk("P2M: %d levels with order-%d root, VTCR 0x%"PRIregister"\n",
            4 - P2M_ROOT_LEVEL, P2M_ROOT_ORDER, val);
 
     p2m_vmid_allocator_init();
diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
index ccc0827107..c7acdb2087 100644
--- a/xen/arch/arm/traps.c
+++ b/xen/arch/arm/traps.c
@@ -911,7 +911,7 @@ static void _show_registers(const struct cpu_user_regs *regs,
         show_registers_32(regs, ctxt, guest_mode, v);
 #endif
     }
-    printk("  VTCR_EL2: %08"PRIx32"\n", READ_SYSREG32(VTCR_EL2));
+    printk("  VTCR_EL2: %"PRIregister"\n", READ_SYSREG(VTCR_EL2));
     printk(" VTTBR_EL2: %016"PRIx64"\n", ctxt->vttbr_el2);
     printk("\n");
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon May 10 17:23:11 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 10 May 2021 17:23:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.125401.236057 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lg9cd-0002iW-K4; Mon, 10 May 2021 17:23:11 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 125401.236057; Mon, 10 May 2021 17:23:11 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lg9cd-0002iM-HG; Mon, 10 May 2021 17:23:11 +0000
Received: by outflank-mailman (input) for mailman id 125401;
 Mon, 10 May 2021 17:23:09 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lg9cb-0002hp-Qc
 for xen-changelog@lists.xenproject.org; Mon, 10 May 2021 17:23:09 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lg9cb-00021h-Pv
 for xen-changelog@lists.xenproject.org; Mon, 10 May 2021 17:23:09 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lg9cb-0008MX-P2
 for xen-changelog@lists.xenproject.org; Mon, 10 May 2021 17:23:09 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=NQ3JaT7Uv5STVNqXv7ncVqre1lRLxeRyfxy7SgHkMwI=; b=KiCOw0WrS8rElCtz18Bwki6HXW
	iX1UetUDOWuT4LXKH1rYmuJGvx/xtv3dn9tDyVVocFCLcqImEPn2az8JnKhN8njXErB8SFF8hd/0n
	ZwDLZCUfPyfOIm922GiWpHdNBCOTjPjcVflRQgl+ANjIx3qiXMh6yXk7f6dbs6qxDxME=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: Always access SCTLR_EL2 using READ/WRITE_SYSREG()
Message-Id: <E1lg9cb-0008MX-P2@xenbits.xenproject.org>
Date: Mon, 10 May 2021 17:23:09 +0000

commit 25e5d0c412e0d7420f2aa7fdd71cc39d8ed6c528
Author:     Michal Orzel <michal.orzel@arm.com>
AuthorDate: Wed May 5 09:43:05 2021 +0200
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Mon May 10 18:16:34 2021 +0100

    xen/arm: Always access SCTLR_EL2 using READ/WRITE_SYSREG()
    
    The Armv8 specification describes the system register as a 64-bit value
    on AArch64 and 32-bit value on AArch32 (same as ARMv7).
    
    Unfortunately, Xen is accessing the system registers using
    READ/WRITE_SYSREG32() which means the top 32-bit are clobbered.
    
    This is only a latent bug so far because Xen will not yet use the top
    32-bit.
    
    There is also no change in behavior because arch/arm/arm64/head.S will
    initialize SCTLR_EL2 to a sane value with the top 32-bit zeroed.
    
    Signed-off-by: Michal Orzel <michal.orzel@arm.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/mm.c    | 2 +-
 xen/arch/arm/traps.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c
index 59f8a3f15f..0e07335291 100644
--- a/xen/arch/arm/mm.c
+++ b/xen/arch/arm/mm.c
@@ -613,7 +613,7 @@ void __init remove_early_mappings(void)
  */
 static void xen_pt_enforce_wnx(void)
 {
-    WRITE_SYSREG32(READ_SYSREG32(SCTLR_EL2) | SCTLR_Axx_ELx_WXN, SCTLR_EL2);
+    WRITE_SYSREG(READ_SYSREG(SCTLR_EL2) | SCTLR_Axx_ELx_WXN, SCTLR_EL2);
     /*
      * The TLBs may cache SCTLR_EL2.WXN. So ensure it is synchronized
      * before flushing the TLBs.
diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
index c7acdb2087..e7384381cc 100644
--- a/xen/arch/arm/traps.c
+++ b/xen/arch/arm/traps.c
@@ -915,7 +915,7 @@ static void _show_registers(const struct cpu_user_regs *regs,
     printk(" VTTBR_EL2: %016"PRIx64"\n", ctxt->vttbr_el2);
     printk("\n");
 
-    printk(" SCTLR_EL2: %08"PRIx32"\n", READ_SYSREG32(SCTLR_EL2));
+    printk(" SCTLR_EL2: %"PRIregister"\n", READ_SYSREG(SCTLR_EL2));
     printk("   HCR_EL2: %"PRIregister"\n", READ_SYSREG(HCR_EL2));
     printk(" TTBR0_EL2: %016"PRIx64"\n", READ_SYSREG64(TTBR0_EL2));
     printk("\n");
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon May 10 17:23:21 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 10 May 2021 17:23:21 +0000
Received: from list by lists.xenproject.org with outflank-mailman.125403.236061 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lg9cn-0002l2-Lk; Mon, 10 May 2021 17:23:21 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 125403.236061; Mon, 10 May 2021 17:23:21 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lg9cn-0002ku-Ip; Mon, 10 May 2021 17:23:21 +0000
Received: by outflank-mailman (input) for mailman id 125403;
 Mon, 10 May 2021 17:23:19 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lg9cl-0002kj-UH
 for xen-changelog@lists.xenproject.org; Mon, 10 May 2021 17:23:19 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lg9cl-00022B-Tf
 for xen-changelog@lists.xenproject.org; Mon, 10 May 2021 17:23:19 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lg9cl-0008Nf-SM
 for xen-changelog@lists.xenproject.org; Mon, 10 May 2021 17:23:19 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=xSyNJnetb2sNAEXIEzGfBGg+XzqTHNy/iLzNi2wzqJI=; b=m1wZudMwaPxA+IsAvpMrNJWiNM
	CESTECOpIRkOFerhotW++C9sKIb0bHDS657osZaAsc4287qQJLj6maZLyxyiOXe9OYyLysaJXxKfJ
	EmR7eQEmF/NaTYTM7EYWVr5BoNrlJSX4Gn1/TgMF0pRL3QPB1YICiqrK3jtgu45Ud8Js=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] arm/page: Get rid of READ/WRITE_SYSREG32
Message-Id: <E1lg9cl-0008Nf-SM@xenbits.xenproject.org>
Date: Mon, 10 May 2021 17:23:19 +0000

commit 86faae561cd8eee819e0f42ba7a18dd180aa49d1
Author:     Michal Orzel <michal.orzel@arm.com>
AuthorDate: Wed May 5 09:43:06 2021 +0200
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Mon May 10 18:16:34 2021 +0100

    arm/page: Get rid of READ/WRITE_SYSREG32
    
    AArch64 registers are 64bit whereas AArch32 registers
    are 32bit or 64bit. MSR/MRS are expecting 64bit values thus
    we should get rid of helpers READ/WRITE_SYSREG32
    in favour of using READ/WRITE_SYSREG.
    We should also use register_t type when reading sysregs
    which can correspond to uint64_t or uint32_t.
    Even though many AArch64 registers have upper 32bit reserved
    it does not mean that they can't be widen in the future.
    
    Modify accesses to CTR_EL0 to use READ/WRITE_SYSREG.
    
    Signed-off-by: Michal Orzel <michal.orzel@arm.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
---
 xen/include/asm-arm/page.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/include/asm-arm/page.h b/xen/include/asm-arm/page.h
index 131507a517..c6f9fb0d4e 100644
--- a/xen/include/asm-arm/page.h
+++ b/xen/include/asm-arm/page.h
@@ -137,10 +137,10 @@ extern size_t dcache_line_bytes;
 
 static inline size_t read_dcache_line_bytes(void)
 {
-    uint32_t ctr;
+    register_t ctr;
 
     /* Read CTR */
-    ctr = READ_SYSREG32(CTR_EL0);
+    ctr = READ_SYSREG(CTR_EL0);
 
     /* Bits 16-19 are the log2 number of words in the cacheline. */
     return (size_t) (4 << ((ctr >> 16) & 0xf));
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon May 10 17:23:31 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 10 May 2021 17:23:31 +0000
Received: from list by lists.xenproject.org with outflank-mailman.125404.236066 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lg9cx-0002o4-Nz; Mon, 10 May 2021 17:23:31 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 125404.236066; Mon, 10 May 2021 17:23:31 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lg9cx-0002ns-KN; Mon, 10 May 2021 17:23:31 +0000
Received: by outflank-mailman (input) for mailman id 125404;
 Mon, 10 May 2021 17:23:30 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lg9cw-0002nL-1X
 for xen-changelog@lists.xenproject.org; Mon, 10 May 2021 17:23:30 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lg9cw-00022L-0r
 for xen-changelog@lists.xenproject.org; Mon, 10 May 2021 17:23:30 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lg9cv-0008Q6-WA
 for xen-changelog@lists.xenproject.org; Mon, 10 May 2021 17:23:29 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=z54n8CB5uBpUl7Kwv23/t/BWc5TwOD39xHAc1ZE/wlM=; b=SQw9Nj7gyfOMORSP/er0jx+Qom
	y7DFjqHx+wqpgJJbh3lh2qNKy+lOi2Y5VkiWaEJxwz1phjJV0e2fwsT/HKGPIRJk6YXfmGmvpt+Aj
	1Xo3P45mRXlAdmxhkkw1izCmmts7MuyIys5hNPK6ERjDRg9iX56coXo5EYueV5g+vNHs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] arm/time,vtimer: Get rid of READ/WRITE_SYSREG32
Message-Id: <E1lg9cv-0008Q6-WA@xenbits.xenproject.org>
Date: Mon, 10 May 2021 17:23:29 +0000

commit 3f568354a95ee2f0c9c553efb94c734fa6848af0
Author:     Michal Orzel <michal.orzel@arm.com>
AuthorDate: Wed May 5 09:43:07 2021 +0200
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Mon May 10 18:16:34 2021 +0100

    arm/time,vtimer: Get rid of READ/WRITE_SYSREG32
    
    AArch64 registers are 64bit whereas AArch32 registers
    are 32bit or 64bit. MSR/MRS are expecting 64bit values thus
    we should get rid of helpers READ/WRITE_SYSREG32
    in favour of using READ/WRITE_SYSREG.
    We should also use register_t type when reading sysregs
    which can correspond to uint64_t or uint32_t.
    Even though many AArch64 registers have upper 32bit reserved
    it does not mean that they can't be widen in the future.
    
    Modify type of vtimer structure's member: ctl to register_t.
    
    Add macro CNTFRQ_MASK containing mask for timer clock frequency
    field of CNTFRQ_EL0 register.
    
    Modify CNTx_CTL_* macros to return unsigned long instead of
    unsigned int as ctl is now of type register_t.
    
    Signed-off-by: Michal Orzel <michal.orzel@arm.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/time.c             | 28 ++++++++++++++--------------
 xen/arch/arm/vtimer.c           | 10 +++++-----
 xen/include/asm-arm/domain.h    |  2 +-
 xen/include/asm-arm/processor.h |  5 ++++-
 4 files changed, 24 insertions(+), 21 deletions(-)

diff --git a/xen/arch/arm/time.c b/xen/arch/arm/time.c
index b0021c2c69..7dbd363537 100644
--- a/xen/arch/arm/time.c
+++ b/xen/arch/arm/time.c
@@ -145,7 +145,7 @@ void __init preinit_xen_time(void)
         preinit_acpi_xen_time();
 
     if ( !cpu_khz )
-        cpu_khz = READ_SYSREG32(CNTFRQ_EL0) / 1000;
+        cpu_khz = (READ_SYSREG(CNTFRQ_EL0) & CNTFRQ_MASK) / 1000;
 
     res = platform_init_time();
     if ( res )
@@ -205,13 +205,13 @@ int reprogram_timer(s_time_t timeout)
 
     if ( timeout == 0 )
     {
-        WRITE_SYSREG32(0, CNTHP_CTL_EL2);
+        WRITE_SYSREG(0, CNTHP_CTL_EL2);
         return 1;
     }
 
     deadline = ns_to_ticks(timeout) + boot_count;
     WRITE_SYSREG64(deadline, CNTHP_CVAL_EL2);
-    WRITE_SYSREG32(CNTx_CTL_ENABLE, CNTHP_CTL_EL2);
+    WRITE_SYSREG(CNTx_CTL_ENABLE, CNTHP_CTL_EL2);
     isb();
 
     /* No need to check for timers in the past; the Generic Timer fires
@@ -223,23 +223,23 @@ int reprogram_timer(s_time_t timeout)
 static void timer_interrupt(int irq, void *dev_id, struct cpu_user_regs *regs)
 {
     if ( irq == (timer_irq[TIMER_HYP_PPI]) &&
-         READ_SYSREG32(CNTHP_CTL_EL2) & CNTx_CTL_PENDING )
+         READ_SYSREG(CNTHP_CTL_EL2) & CNTx_CTL_PENDING )
     {
         perfc_incr(hyp_timer_irqs);
         /* Signal the generic timer code to do its work */
         raise_softirq(TIMER_SOFTIRQ);
         /* Disable the timer to avoid more interrupts */
-        WRITE_SYSREG32(0, CNTHP_CTL_EL2);
+        WRITE_SYSREG(0, CNTHP_CTL_EL2);
     }
 
     if ( irq == (timer_irq[TIMER_PHYS_NONSECURE_PPI]) &&
-         READ_SYSREG32(CNTP_CTL_EL0) & CNTx_CTL_PENDING )
+         READ_SYSREG(CNTP_CTL_EL0) & CNTx_CTL_PENDING )
     {
         perfc_incr(phys_timer_irqs);
         /* Signal the generic timer code to do its work */
         raise_softirq(TIMER_SOFTIRQ);
         /* Disable the timer to avoid more interrupts */
-        WRITE_SYSREG32(0, CNTP_CTL_EL0);
+        WRITE_SYSREG(0, CNTP_CTL_EL0);
     }
 }
 
@@ -260,8 +260,8 @@ static void vtimer_interrupt(int irq, void *dev_id, struct cpu_user_regs *regs)
 
     perfc_incr(virt_timer_irqs);
 
-    current->arch.virt_timer.ctl = READ_SYSREG32(CNTV_CTL_EL0);
-    WRITE_SYSREG32(current->arch.virt_timer.ctl | CNTx_CTL_MASK, CNTV_CTL_EL0);
+    current->arch.virt_timer.ctl = READ_SYSREG(CNTV_CTL_EL0);
+    WRITE_SYSREG(current->arch.virt_timer.ctl | CNTx_CTL_MASK, CNTV_CTL_EL0);
     vgic_inject_irq(current->domain, current, current->arch.virt_timer.irq, true);
 }
 
@@ -297,9 +297,9 @@ void init_timer_interrupt(void)
     /* Sensible defaults */
     WRITE_SYSREG64(0, CNTVOFF_EL2);     /* No VM-specific offset */
     /* Do not let the VMs program the physical timer, only read the physical counter */
-    WRITE_SYSREG32(CNTHCTL_EL2_EL1PCTEN, CNTHCTL_EL2);
-    WRITE_SYSREG32(0, CNTP_CTL_EL0);    /* Physical timer disabled */
-    WRITE_SYSREG32(0, CNTHP_CTL_EL2);   /* Hypervisor's timer disabled */
+    WRITE_SYSREG(CNTHCTL_EL2_EL1PCTEN, CNTHCTL_EL2);
+    WRITE_SYSREG(0, CNTP_CTL_EL0);    /* Physical timer disabled */
+    WRITE_SYSREG(0, CNTHP_CTL_EL2);   /* Hypervisor's timer disabled */
     isb();
 
     request_irq(timer_irq[TIMER_HYP_PPI], 0, timer_interrupt,
@@ -320,8 +320,8 @@ void init_timer_interrupt(void)
  */
 static void deinit_timer_interrupt(void)
 {
-    WRITE_SYSREG32(0, CNTP_CTL_EL0);    /* Disable physical timer */
-    WRITE_SYSREG32(0, CNTHP_CTL_EL2);   /* Disable hypervisor's timer */
+    WRITE_SYSREG(0, CNTP_CTL_EL0);    /* Disable physical timer */
+    WRITE_SYSREG(0, CNTHP_CTL_EL2);   /* Disable hypervisor's timer */
     isb();
 
     release_irq(timer_irq[TIMER_HYP_PPI], NULL);
diff --git a/xen/arch/arm/vtimer.c b/xen/arch/arm/vtimer.c
index c2b27915c6..167fc6127a 100644
--- a/xen/arch/arm/vtimer.c
+++ b/xen/arch/arm/vtimer.c
@@ -138,8 +138,8 @@ void virt_timer_save(struct vcpu *v)
 {
     ASSERT(!is_idle_vcpu(v));
 
-    v->arch.virt_timer.ctl = READ_SYSREG32(CNTV_CTL_EL0);
-    WRITE_SYSREG32(v->arch.virt_timer.ctl & ~CNTx_CTL_ENABLE, CNTV_CTL_EL0);
+    v->arch.virt_timer.ctl = READ_SYSREG(CNTV_CTL_EL0);
+    WRITE_SYSREG(v->arch.virt_timer.ctl & ~CNTx_CTL_ENABLE, CNTV_CTL_EL0);
     v->arch.virt_timer.cval = READ_SYSREG64(CNTV_CVAL_EL0);
     if ( (v->arch.virt_timer.ctl & CNTx_CTL_ENABLE) &&
          !(v->arch.virt_timer.ctl & CNTx_CTL_MASK))
@@ -159,7 +159,7 @@ void virt_timer_restore(struct vcpu *v)
 
     WRITE_SYSREG64(v->domain->arch.virt_timer_base.offset, CNTVOFF_EL2);
     WRITE_SYSREG64(v->arch.virt_timer.cval, CNTV_CVAL_EL0);
-    WRITE_SYSREG32(v->arch.virt_timer.ctl, CNTV_CTL_EL0);
+    WRITE_SYSREG(v->arch.virt_timer.ctl, CNTV_CTL_EL0);
 }
 
 static bool vtimer_cntp_ctl(struct cpu_user_regs *regs, uint32_t *r, bool read)
@@ -347,7 +347,7 @@ bool vtimer_emulate(struct cpu_user_regs *regs, union hsr hsr)
 }
 
 static void vtimer_update_irq(struct vcpu *v, struct vtimer *vtimer,
-                              uint32_t vtimer_ctl)
+                              register_t vtimer_ctl)
 {
     bool level;
 
@@ -389,7 +389,7 @@ void vtimer_update_irqs(struct vcpu *v)
      * but this requires reworking the arch timer to implement this.
      */
     vtimer_update_irq(v, &v->arch.virt_timer,
-                      READ_SYSREG32(CNTV_CTL_EL0) & ~CNTx_CTL_MASK);
+                      READ_SYSREG(CNTV_CTL_EL0) & ~CNTx_CTL_MASK);
 
     /* For the physical timer we rely on our emulated state. */
     vtimer_update_irq(v, &v->arch.phys_timer, v->arch.phys_timer.ctl);
diff --git a/xen/include/asm-arm/domain.h b/xen/include/asm-arm/domain.h
index 2d4f38c669..c9277b5c6d 100644
--- a/xen/include/asm-arm/domain.h
+++ b/xen/include/asm-arm/domain.h
@@ -36,7 +36,7 @@ struct vtimer {
     struct vcpu *v;
     int irq;
     struct timer timer;
-    uint32_t ctl;
+    register_t ctl;
     uint64_t cval;
 };
 
diff --git a/xen/include/asm-arm/processor.h b/xen/include/asm-arm/processor.h
index 5c1768cdec..2577e9a244 100644
--- a/xen/include/asm-arm/processor.h
+++ b/xen/include/asm-arm/processor.h
@@ -485,9 +485,12 @@ extern register_t __cpu_logical_map[];
 
 /* Timer control registers */
 #define CNTx_CTL_ENABLE   (1u<<0)  /* Enable timer */
-#define CNTx_CTL_MASK     (1u<<1)  /* Mask IRQ */
+#define CNTx_CTL_MASK     (1ul<<1)  /* Mask IRQ */
 #define CNTx_CTL_PENDING  (1u<<2)  /* IRQ pending */
 
+/* Timer frequency mask */
+#define CNTFRQ_MASK       GENMASK(31, 0)
+
 /* Exception Vector offsets */
 /* ... ARM32 */
 #define VECTOR32_RST  0
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon May 10 17:33:09 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 10 May 2021 17:33:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.125414.236093 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lg9mD-0004t3-T2; Mon, 10 May 2021 17:33:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 125414.236093; Mon, 10 May 2021 17:33:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lg9mD-0004sv-QB; Mon, 10 May 2021 17:33:05 +0000
Received: by outflank-mailman (input) for mailman id 125414;
 Mon, 10 May 2021 17:33:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lg9mC-0004sm-OU
 for xen-changelog@lists.xenproject.org; Mon, 10 May 2021 17:33:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lg9mC-0002EY-Kq
 for xen-changelog@lists.xenproject.org; Mon, 10 May 2021 17:33:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lg9mC-0000qP-Jt
 for xen-changelog@lists.xenproject.org; Mon, 10 May 2021 17:33:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=jFtzkyQyeV6qrQaX0xyimz7eRXoGmjTvQUFjUp7ybkk=; b=YMxwuZbPowWvFLxi1+0ZWvH2DW
	Q0uUz15lbKzyImzz0ZVfso641E3LNCLLoxfXcVZgG2ytJ1UCJMyB03/5AJT3wgvBbyyUL39LzzYBY
	VyJdjnEdKMcdNsFlyBmlPTuHH7hCekvQbv7sNNhs0iXCjj0G7aiwBkelD4uzOnSQacdE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/xenstored: Prevent a buffer overflow in dump_state_node_perms()
Message-Id: <E1lg9mC-0000qP-Jt@xenbits.xenproject.org>
Date: Mon, 10 May 2021 17:33:04 +0000

commit 7e71b1e0affa83c0976c832f254276eeb6e6575c
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Thu May 6 17:12:23 2021 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Mon May 10 18:25:52 2021 +0100

    tools/xenstored: Prevent a buffer overflow in dump_state_node_perms()
    
    ASAN reported one issue when Live Updating Xenstored:
    
    =================================================================
    ==873==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7ffc194f53e0 at pc 0x555c6b323292 bp 0x7ffc194f5340 sp 0x7ffc194f5338
    WRITE of size 1 at 0x7ffc194f53e0 thread T0
        #0 0x555c6b323291 in dump_state_node_perms xen/tools/xenstore/xenstored_core.c:2468
        #1 0x555c6b32746e in dump_state_special_node xen/tools/xenstore/xenstored_domain.c:1257
        #2 0x555c6b32a702 in dump_state_special_nodes xen/tools/xenstore/xenstored_domain.c:1273
        #3 0x555c6b32ddb3 in lu_dump_state xen/tools/xenstore/xenstored_control.c:521
        #4 0x555c6b32e380 in do_lu_start xen/tools/xenstore/xenstored_control.c:660
        #5 0x555c6b31b461 in call_delayed xen/tools/xenstore/xenstored_core.c:278
        #6 0x555c6b32275e in main xen/tools/xenstore/xenstored_core.c:2357
        #7 0x7f95eecf3d09 in __libc_start_main ../csu/libc-start.c:308
        #8 0x555c6b3197e9 in _start (/usr/local/sbin/xenstored+0xc7e9)
    
    Address 0x7ffc194f53e0 is located in stack of thread T0 at offset 80 in frame
        #0 0x555c6b32713e in dump_state_special_node xen/tools/xenstore/xenstored_domain.c:1232
    
      This frame has 2 object(s):
        [32, 40) 'head' (line 1233)
        [64, 80) 'sn' (line 1234) <== Memory access at offset 80 overflows this variable
    
    This is happening because the callers are passing a pointer to a variable
    allocated on the stack. However, the field perms is a dynamic array, so
    Xenstored will end up to read outside of the variable.
    
    Rework the code so the permissions are written one by one in the fd.
    
    Fixes: ed6eebf17d2c ("tools/xenstore: dump the xenstore state for live update")
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
---
 tools/xenstore/xenstored_core.c   | 26 ++++++++++++++------------
 tools/xenstore/xenstored_core.h   |  3 +--
 tools/xenstore/xenstored_domain.c |  2 +-
 3 files changed, 16 insertions(+), 15 deletions(-)

diff --git a/tools/xenstore/xenstored_core.c b/tools/xenstore/xenstored_core.c
index c638e46221..02ae390e25 100644
--- a/tools/xenstore/xenstored_core.c
+++ b/tools/xenstore/xenstored_core.c
@@ -2447,34 +2447,36 @@ const char *dump_state_buffered_data(FILE *fp, const struct connection *c,
 	return NULL;
 }
 
-const char *dump_state_node_perms(FILE *fp, struct xs_state_node *sn,
-				  const struct xs_permissions *perms,
+const char *dump_state_node_perms(FILE *fp, const struct xs_permissions *perms,
 				  unsigned int n_perms)
 {
 	unsigned int p;
 
 	for (p = 0; p < n_perms; p++) {
+		struct xs_state_node_perm sp;
+
 		switch ((int)perms[p].perms & ~XS_PERM_IGNORE) {
 		case XS_PERM_READ:
-			sn->perms[p].access = XS_STATE_NODE_PERM_READ;
+			sp.access = XS_STATE_NODE_PERM_READ;
 			break;
 		case XS_PERM_WRITE:
-			sn->perms[p].access = XS_STATE_NODE_PERM_WRITE;
+			sp.access = XS_STATE_NODE_PERM_WRITE;
 			break;
 		case XS_PERM_READ | XS_PERM_WRITE:
-			sn->perms[p].access = XS_STATE_NODE_PERM_BOTH;
+			sp.access = XS_STATE_NODE_PERM_BOTH;
 			break;
 		default:
-			sn->perms[p].access = XS_STATE_NODE_PERM_NONE;
+			sp.access = XS_STATE_NODE_PERM_NONE;
 			break;
 		}
-		sn->perms[p].flags = (perms[p].perms & XS_PERM_IGNORE)
+		sp.flags = (perms[p].perms & XS_PERM_IGNORE)
 				     ? XS_STATE_NODE_PERM_IGNORE : 0;
-		sn->perms[p].domid = perms[p].id;
-	}
+		sp.domid = perms[p].id;
 
-	if (fwrite(sn->perms, sizeof(*sn->perms), n_perms, fp) != n_perms)
-		return "Dump node permissions error";
+		if (fwrite(&sp, sizeof(sp), 1, fp) != 1)
+			return "Dump node permission error";
+
+	}
 
 	return NULL;
 }
@@ -2519,7 +2521,7 @@ static const char *dump_state_node_tree(FILE *fp, char *path)
 	if (fwrite(&sn, sizeof(sn), 1, fp) != 1)
 		return "Dump node state error";
 
-	ret = dump_state_node_perms(fp, &sn, hdr->perms, hdr->num_perms);
+	ret = dump_state_node_perms(fp, hdr->perms, hdr->num_perms);
 	if (ret)
 		return ret;
 
diff --git a/tools/xenstore/xenstored_core.h b/tools/xenstore/xenstored_core.h
index 1cdbc3dcb5..b50ea3f57d 100644
--- a/tools/xenstore/xenstored_core.h
+++ b/tools/xenstore/xenstored_core.h
@@ -271,8 +271,7 @@ const char *dump_state_buffered_data(FILE *fp, const struct connection *c,
 				     const struct connection *conn,
 				     struct xs_state_connection *sc);
 const char *dump_state_nodes(FILE *fp, const void *ctx);
-const char *dump_state_node_perms(FILE *fp, struct xs_state_node *sn,
-				  const struct xs_permissions *perms,
+const char *dump_state_node_perms(FILE *fp, const struct xs_permissions *perms,
 				  unsigned int n_perms);
 
 void read_state_global(const void *ctx, const void *state);
diff --git a/tools/xenstore/xenstored_domain.c b/tools/xenstore/xenstored_domain.c
index 2d333b3ff6..0c17937c0f 100644
--- a/tools/xenstore/xenstored_domain.c
+++ b/tools/xenstore/xenstored_domain.c
@@ -1254,7 +1254,7 @@ static const char *dump_state_special_node(FILE *fp, const char *name,
 	if (fwrite(&sn, sizeof(sn), 1, fp) != 1)
 		return "Dump special node error";
 
-	ret = dump_state_node_perms(fp, &sn, perms->p, perms->num);
+	ret = dump_state_node_perms(fp, perms->p, perms->num);
 	if (ret)
 		return ret;
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon May 10 17:33:16 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 10 May 2021 17:33:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.125415.236097 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lg9mN-0004zW-WF; Mon, 10 May 2021 17:33:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 125415.236097; Mon, 10 May 2021 17:33:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lg9mN-0004zO-T5; Mon, 10 May 2021 17:33:15 +0000
Received: by outflank-mailman (input) for mailman id 125415;
 Mon, 10 May 2021 17:33:14 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lg9mM-0004zD-PT
 for xen-changelog@lists.xenproject.org; Mon, 10 May 2021 17:33:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lg9mM-0002Ez-OZ
 for xen-changelog@lists.xenproject.org; Mon, 10 May 2021 17:33:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lg9mM-0000rY-NQ
 for xen-changelog@lists.xenproject.org; Mon, 10 May 2021 17:33:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=lz5xa/HDEfqUcwHiKN7QV9wBmxirCY+NV6HvYCzMlvw=; b=2HqD04xRdv93QB+MUSSVhVmSuj
	fJqnjp9gMlUe4YroQ5q8ME1569LxQvpYOx/rtR4fkI+9quWm39rIr/1H3YfxfyT8Rl9tl+0wyvBXp
	8kf7s1fuemL4BetWR8So091WcmNW50a1csPXI9/QsdXvE9FM8OLzxgpetAOiFwIpZuQ4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/xenstore: Fix indentation in the header of xenstored_control.c
Message-Id: <E1lg9mM-0000rY-NQ@xenbits.xenproject.org>
Date: Mon, 10 May 2021 17:33:14 +0000

commit 30f34457b20c78b2862b2b16cb26cb4f10a667ad
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Mon May 10 18:28:16 2021 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Mon May 10 18:28:20 2021 +0100

    tools/xenstore: Fix indentation in the header of xenstored_control.c
    
    Commit e867af081d94 "tools/xenstore: save new binary for live update"
    seemed to have spuriously changed the indentation of the first line of
    the copyright header.
    
    The previous indentation is re-instated so all the lines are indented
    the same.
    
    Reported-by: Bjoern Doebel <doebel@amazon.com>
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
---
 tools/xenstore/xenstored_control.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/xenstore/xenstored_control.c b/tools/xenstore/xenstored_control.c
index 8e470f2b20..52d4817679 100644
--- a/tools/xenstore/xenstored_control.c
+++ b/tools/xenstore/xenstored_control.c
@@ -1,5 +1,5 @@
 /*
-Interactive commands for Xen Store Daemon.
+    Interactive commands for Xen Store Daemon.
     Copyright (C) 2017 Juergen Gross, SUSE Linux GmbH
 
     This program is free software; you can redistribute it and/or modify
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon May 10 17:44:08 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 10 May 2021 17:44:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.125427.236125 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lg9ws-0007AP-8i; Mon, 10 May 2021 17:44:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 125427.236125; Mon, 10 May 2021 17:44:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lg9ws-0007AI-5S; Mon, 10 May 2021 17:44:06 +0000
Received: by outflank-mailman (input) for mailman id 125427;
 Mon, 10 May 2021 17:44:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lg9wq-00079N-UU
 for xen-changelog@lists.xenproject.org; Mon, 10 May 2021 17:44:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lg9wq-0002Rt-Tm
 for xen-changelog@lists.xenproject.org; Mon, 10 May 2021 17:44:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lg9wq-000298-Sq
 for xen-changelog@lists.xenproject.org; Mon, 10 May 2021 17:44:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Gkf8mMyq81I+UImEFkPOI2lJAvxY87mo/HFSdQumbhI=; b=0K0ISRNiozdpUJLhXXCTA/T5FF
	BYXw9lDzrYndenRzYsiRe+qFmCnI58Bey1LKzjuUzZxEc26yihPponDfIX+6k9HEqkRXFRE5PlXd3
	LL/6cIVVpbk47tSlGQAd1glLZSg9scUz5soeFmfDDTYGS4JQbKi4MUr2eJflRJ6/12cU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] optee: enable OPTEE_SMC_SEC_CAP_MEMREF_NULL capability
Message-Id: <E1lg9wq-000298-Sq@xenbits.xenproject.org>
Date: Mon, 10 May 2021 17:44:04 +0000

commit d4fb5f166c2bfbaf9ba0de69da0d411288f437a9
Author:     Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>
AuthorDate: Fri May 7 01:39:47 2021 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Mon May 10 18:35:46 2021 +0100

    optee: enable OPTEE_SMC_SEC_CAP_MEMREF_NULL capability
    
    OP-TEE mediator already have support for NULL memory references. It
    was added in patch 0dbed3ad336 ("optee: allow plain TMEM buffers with
    NULL address"). But it does not propagate
    OPTEE_SMC_SEC_CAP_MEMREF_NULL capability flag to a guest, so well
    behaving guest can't use this feature.
    
    Note: linux optee driver honors this capability flag when handling
    buffers from userspace clients, but ignores it when working with
    internal calls. For instance, __optee_enumerate_devices() function
    uses NULL argument to get buffer size hint from OP-TEE. This was the
    reason, why "optee: allow plain TMEM buffers with NULL address" was
    introduced in the first place.
    
    This patch adds the mentioned capability to list of known
    capabilities. From Linux point of view it means that userspace clients
    can use this feature, which is confirmed by OP-TEE test suite:
    
    * regression_1025 Test memref NULL and/or 0 bytes size
    o regression_1025.1 Invalid NULL buffer memref registration
      regression_1025.1 OK
    o regression_1025.2 Input/Output MEMREF Buffer NULL - Size 0 bytes
      regression_1025.2 OK
    o regression_1025.3 Input MEMREF Buffer NULL - Size non 0 bytes
      regression_1025.3 OK
    o regression_1025.4 Input MEMREF Buffer NULL over PTA invocation
      regression_1025.4 OK
      regression_1025 OK
    
    Signed-off-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/tee/optee.c            | 3 ++-
 xen/include/asm-arm/tee/optee_smc.h | 3 +++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/tee/optee.c b/xen/arch/arm/tee/optee.c
index 980eebe847..345361566e 100644
--- a/xen/arch/arm/tee/optee.c
+++ b/xen/arch/arm/tee/optee.c
@@ -96,7 +96,8 @@
 #define OPTEE_KNOWN_NSEC_CAPS OPTEE_SMC_NSEC_CAP_UNIPROCESSOR
 #define OPTEE_KNOWN_SEC_CAPS (OPTEE_SMC_SEC_CAP_HAVE_RESERVED_SHM | \
                               OPTEE_SMC_SEC_CAP_UNREGISTERED_SHM | \
-                              OPTEE_SMC_SEC_CAP_DYNAMIC_SHM)
+                              OPTEE_SMC_SEC_CAP_DYNAMIC_SHM | \
+                              OPTEE_SMC_SEC_CAP_MEMREF_NULL)
 
 enum optee_call_state {
     OPTEE_CALL_NORMAL,
diff --git a/xen/include/asm-arm/tee/optee_smc.h b/xen/include/asm-arm/tee/optee_smc.h
index d568bb2fe1..2f5c702326 100644
--- a/xen/include/asm-arm/tee/optee_smc.h
+++ b/xen/include/asm-arm/tee/optee_smc.h
@@ -244,6 +244,9 @@
  */
 #define OPTEE_SMC_SEC_CAP_DYNAMIC_SHM		(1 << 2)
 
+/* Secure world supports Shared Memory with a NULL reference */
+#define OPTEE_SMC_SEC_CAP_MEMREF_NULL		(1 << 4)
+
 #define OPTEE_SMC_FUNCID_EXCHANGE_CAPABILITIES	9
 #define OPTEE_SMC_EXCHANGE_CAPABILITIES \
 	OPTEE_SMC_FAST_CALL_VAL(OPTEE_SMC_FUNCID_EXCHANGE_CAPABILITIES)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue May 11 09:55:12 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 11 May 2021 09:55:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.125714.236618 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lgP6V-0003PZ-Ig; Tue, 11 May 2021 09:55:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 125714.236618; Tue, 11 May 2021 09:55:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lgP6V-0003PR-Fk; Tue, 11 May 2021 09:55:03 +0000
Received: by outflank-mailman (input) for mailman id 125714;
 Tue, 11 May 2021 09:55:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lgP6U-0003PL-St
 for xen-changelog@lists.xenproject.org; Tue, 11 May 2021 09:55:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lgP6U-00010y-PR
 for xen-changelog@lists.xenproject.org; Tue, 11 May 2021 09:55:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lgP6U-0000l5-OH
 for xen-changelog@lists.xenproject.org; Tue, 11 May 2021 09:55:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=apQw18PRUX+tkM2H1u22jxX2ech/Q5RGivm6B6r3jXg=; b=fDXWxiWjUjwO6IoZVGmM8OQCpM
	8+76RqgHDldAUwwaLBDRw4XyxsSYLydstVo4MJ/LmcZP8+YDaTXrO5lvoUkFlFkXJW5k6OCSUUHrX
	D5xMQPWsB6zDvn2MAtmF8ItppxTePcyW0Gcw0QR072G2cL5hHQ8/5UFeaStgBUGaiPFk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] vtpmmgr: Allow specifying srk_handle for TPM2
Message-Id: <E1lgP6U-0000l5-OH@xenbits.xenproject.org>
Date: Tue, 11 May 2021 09:55:02 +0000

commit 3f1b5080d64d2b66a686133e9f24998a3609d1a3
Author:     Jason Andryuk <jandryuk@gmail.com>
AuthorDate: Thu May 6 09:59:14 2021 -0400
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon May 10 14:48:13 2021 +0100

    vtpmmgr: Allow specifying srk_handle for TPM2
    
    Bypass taking ownership of the TPM2 if an srk_handle is specified.
    
    This srk_handle must be usable with Null auth for the time being.
    
    Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
    Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
    Reviewed-by: Daniel P. Smith <dpsmith@apertussolutions.com>
---
 docs/man/xen-vtpmmgr.7.pod |  7 +++++++
 stubdom/vtpmmgr/init.c     | 11 ++++++++++-
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/docs/man/xen-vtpmmgr.7.pod b/docs/man/xen-vtpmmgr.7.pod
index 875dcce508..3286954568 100644
--- a/docs/man/xen-vtpmmgr.7.pod
+++ b/docs/man/xen-vtpmmgr.7.pod
@@ -92,6 +92,13 @@ Valid arguments:
 
 =over 4
 
+=item srk_handle=<HANDLE>
+
+Specify a srk_handle for TPM 2.0.  TPM 2.0 uses a key hierarchy, and
+this allow specifying the parent handle for vtpmmgr to create its own
+key under.  Using this option bypasses vtpmmgr trying to take ownership
+of the TPM.
+
 =item owner_auth=<AUTHSPEC>
 
 =item srk_auth=<AUTHSPEC>
diff --git a/stubdom/vtpmmgr/init.c b/stubdom/vtpmmgr/init.c
index 2d314d98e8..decf8e8b4d 100644
--- a/stubdom/vtpmmgr/init.c
+++ b/stubdom/vtpmmgr/init.c
@@ -302,6 +302,11 @@ int parse_cmdline_opts(int argc, char** argv, struct Opts* opts)
             goto err_invalid;
          }
       }
+      else if(!strncmp(argv[i], "srk_handle=", 11)) {
+         if(sscanf(argv[i] + 11, "%x", &vtpm_globals.srk_handle) != 1) {
+            goto err_invalid;
+         }
+      }
       else if(!strncmp(argv[i], "tpmdriver=", 10)) {
          if(!strcmp(argv[i] + 10, "tpm_tis")) {
             opts->tpmdriver = TPMDRV_TPM_TIS;
@@ -572,7 +577,11 @@ TPM_RESULT vtpmmgr2_create(void)
 {
     TPM_RESULT status = TPM_SUCCESS;
 
-    TPMTRYRETURN(tpm2_take_ownership());
+    if ( vtpm_globals.srk_handle == 0 ) {
+        TPMTRYRETURN(tpm2_take_ownership());
+    } else {
+        tpm2_AuthArea_ctor(NULL, 0, &vtpm_globals.srk_auth_area);
+    }
 
    /* create SK */
     TPM2_Create_Params_out out;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue May 11 09:55:13 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 11 May 2021 09:55:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.125715.236622 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lgP6f-0003RH-KC; Tue, 11 May 2021 09:55:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 125715.236622; Tue, 11 May 2021 09:55:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lgP6f-0003R9-HJ; Tue, 11 May 2021 09:55:13 +0000
Received: by outflank-mailman (input) for mailman id 125715;
 Tue, 11 May 2021 09:55:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lgP6e-0003R1-TS
 for xen-changelog@lists.xenproject.org; Tue, 11 May 2021 09:55:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lgP6e-000119-Si
 for xen-changelog@lists.xenproject.org; Tue, 11 May 2021 09:55:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lgP6e-0000lw-Rh
 for xen-changelog@lists.xenproject.org; Tue, 11 May 2021 09:55:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=/gRgMtV+6hucEJq6JDJ5mx3+fCavnUb/bDTh14pjcjk=; b=fYsdAinr6oq9oENP91XhVgJMCK
	WcdMiZkxl4NCIS0uoZMFw6gOJsGbbGe8ODAzPFSwaflxKJcKh4jiDeapPzkYgGhoiuYUt+xLSiI5i
	WZ3F/FX3nS9WLD3tQ0l2EEbOgpIdUjPoxaPYiiI+8VLays42w115PWDxUJ19fBlJtfHY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] vtpmmgr: Flush transient keys on shutdown
Message-Id: <E1lgP6e-0000lw-Rh@xenbits.xenproject.org>
Date: Tue, 11 May 2021 09:55:12 +0000

commit ec9596dc534d6869ddcb2fb78a0c5accc91e3f38
Author:     Jason Andryuk <jandryuk@gmail.com>
AuthorDate: Thu May 6 09:59:16 2021 -0400
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon May 10 14:49:00 2021 +0100

    vtpmmgr: Flush transient keys on shutdown
    
    Remove our key so it isn't left in the TPM for someone to come along
    after vtpmmgr shutsdown.
    
    Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
    Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
    Reviewed-by: Daniel P. Smith <dpsmith@apertussolutions.com>
---
 stubdom/vtpmmgr/init.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/stubdom/vtpmmgr/init.c b/stubdom/vtpmmgr/init.c
index decf8e8b4d..56b4be85b3 100644
--- a/stubdom/vtpmmgr/init.c
+++ b/stubdom/vtpmmgr/init.c
@@ -792,6 +792,14 @@ void vtpmmgr_shutdown(void)
    /* Close tpmback */
    shutdown_tpmback();
 
+    if (hw_is_tpm2()) {
+        /* Blow away all stale handles left in the tpm*/
+        if (flush_tpm2() != TPM_SUCCESS) {
+            vtpmlogerror(VTPM_LOG_TPM,
+                         "TPM2_FlushResources failed, continuing shutdown..\n");
+        }
+    }
+
    /* Close tpmfront/tpm_tis */
    close(vtpm_globals.tpm_fd);
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue May 11 09:55:23 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 11 May 2021 09:55:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.125716.236627 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lgP6p-0003Uc-MY; Tue, 11 May 2021 09:55:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 125716.236627; Tue, 11 May 2021 09:55:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lgP6p-0003UT-Iu; Tue, 11 May 2021 09:55:23 +0000
Received: by outflank-mailman (input) for mailman id 125716;
 Tue, 11 May 2021 09:55:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lgP6p-0003UB-0M
 for xen-changelog@lists.xenproject.org; Tue, 11 May 2021 09:55:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lgP6o-00011Q-Vt
 for xen-changelog@lists.xenproject.org; Tue, 11 May 2021 09:55:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lgP6o-0000mi-Un
 for xen-changelog@lists.xenproject.org; Tue, 11 May 2021 09:55:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=rmgX2/t6X6L9WClxrofP3wEtecC91GGLIsucuR2Mnd4=; b=akVGM+fNp9ejYQhQqHW6eub6c9
	bbloclFFaQ8XoNw0kfAbAaDQl04y7vWYQIxMEEajK6R20WoiFfNCKlYVeBhhCdU/pF9jJmksWoi50
	YcdaGvo8jpA39yrONkDtekq+/heNApJFMSsO539XDqLqMVu0wiCsS5xV/S6sTs+8i3/Q=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] vtpmmgr: Flush all transient keys
Message-Id: <E1lgP6o-0000mi-Un@xenbits.xenproject.org>
Date: Tue, 11 May 2021 09:55:22 +0000

commit 746d20b112ace151b19f06bd5e1fb3d695d8982e
Author:     Jason Andryuk <jandryuk@gmail.com>
AuthorDate: Thu May 6 09:59:17 2021 -0400
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon May 10 14:49:01 2021 +0100

    vtpmmgr: Flush all transient keys
    
    We're only flushing 2 transients, but there are 3 handles.  Use <= to also
    flush the third handle since TRANSIENT_LAST is inclusive
    
    The number of transient handles/keys is hardware dependent, so this
    should query for the limit.  And assignment of handles is assumed to be
    sequential from the minimum.  That may not be guaranteed, but seems okay
    with my tpm2.
    
    Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
    Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
    Reviewed-by: Daniel P. Smith <dpsmith@apertussolutions.com>
---
 stubdom/vtpmmgr/init.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/stubdom/vtpmmgr/init.c b/stubdom/vtpmmgr/init.c
index 56b4be85b3..4ae34a4fcb 100644
--- a/stubdom/vtpmmgr/init.c
+++ b/stubdom/vtpmmgr/init.c
@@ -656,7 +656,7 @@ static TPM_RC flush_tpm2(void)
 {
     int i;
 
-    for (i = TRANSIENT_FIRST; i < TRANSIENT_LAST; i++)
+    for (i = TRANSIENT_FIRST; i <= TRANSIENT_LAST; i++)
          TPM2_FlushContext(i);
 
     return TPM_SUCCESS;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue May 11 09:55:34 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 11 May 2021 09:55:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.125717.236630 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lgP70-0003YK-Ne; Tue, 11 May 2021 09:55:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 125717.236630; Tue, 11 May 2021 09:55:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lgP70-0003YC-KV; Tue, 11 May 2021 09:55:34 +0000
Received: by outflank-mailman (input) for mailman id 125717;
 Tue, 11 May 2021 09:55:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lgP6z-0003Xl-3E
 for xen-changelog@lists.xenproject.org; Tue, 11 May 2021 09:55:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lgP6z-000120-2V
 for xen-changelog@lists.xenproject.org; Tue, 11 May 2021 09:55:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lgP6z-0000nP-1k
 for xen-changelog@lists.xenproject.org; Tue, 11 May 2021 09:55:33 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=yHzcOfj3togX60ndxM+LpvwNpNOp4UjnC+8bpjHe5Yo=; b=xi7PlSMfkbifsS626yxrlxAW9o
	YfrcqyogVeVf53zBFF/nvMLeeEuZHYyLirQE1R5ttEpP1NEJjs8YrmvK1UieXf62EJyF3U3pcXJMU
	K+lj0Y9RyFTm1uLBVbfCBwRiLbfTEcCDszKDKPD3wORNQH39jZOXGrbhHcxKBD6l5s6I=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] vtpmmgr: Shutdown more gracefully
Message-Id: <E1lgP6z-0000nP-1k@xenbits.xenproject.org>
Date: Tue, 11 May 2021 09:55:33 +0000

commit 1b4bfa0b8f6a47c2b80bdc203bb0487fe1bd4366
Author:     Jason Andryuk <jandryuk@gmail.com>
AuthorDate: Thu May 6 09:59:18 2021 -0400
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon May 10 14:49:01 2021 +0100

    vtpmmgr: Shutdown more gracefully
    
    vtpmmgr uses the default, weak app_shutdown, which immediately calls the
    shutdown hypercall.  This short circuits the vtpmmgr clean up logic.  We
    need to perform the clean up to actually Flush our key out of the tpm.
    
    Setting do_shutdown is one step in that direction, but vtpmmgr will most
    likely be waiting in tpmback_req_any.  We need to call shutdown_tpmback
    to cancel the wait inside tpmback and perform the shutdown.
    
    Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
    Reviewed-by: Samuel Thibault <samuel.thibaut@ens-lyon.org>
    Reviewed-by: Daniel P. Smith <dpsmith@apertussolutions.com>
---
 stubdom/vtpmmgr/vtpmmgr.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/stubdom/vtpmmgr/vtpmmgr.c b/stubdom/vtpmmgr/vtpmmgr.c
index 9fddaa24f8..46ea018921 100644
--- a/stubdom/vtpmmgr/vtpmmgr.c
+++ b/stubdom/vtpmmgr/vtpmmgr.c
@@ -67,11 +67,21 @@ int hw_is_tpm2(void)
     return (hardware_version.hw_version == TPM2_HARDWARE) ? 1 : 0;
 }
 
+static int do_shutdown;
+
+void app_shutdown(unsigned int reason)
+{
+    printk("Shutdown requested: %d\n", reason);
+    do_shutdown = 1;
+
+    shutdown_tpmback();
+}
+
 void main_loop(void) {
    tpmcmd_t* tpmcmd;
    uint8_t respbuf[TCPA_MAX_BUFFER_LENGTH];
 
-   while(1) {
+   while (!do_shutdown) {
       /* Wait for requests from a vtpm */
       vtpmloginfo(VTPM_LOG_VTPM, "Waiting for commands from vTPM's:\n");
       if((tpmcmd = tpmback_req_any()) == NULL) {
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue May 11 09:55:44 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 11 May 2021 09:55:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.125718.236633 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lgP7A-0003bC-P7; Tue, 11 May 2021 09:55:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 125718.236633; Tue, 11 May 2021 09:55:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lgP7A-0003b4-MI; Tue, 11 May 2021 09:55:44 +0000
Received: by outflank-mailman (input) for mailman id 125718;
 Tue, 11 May 2021 09:55:43 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lgP79-0003ap-6x
 for xen-changelog@lists.xenproject.org; Tue, 11 May 2021 09:55:43 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lgP79-00012H-66
 for xen-changelog@lists.xenproject.org; Tue, 11 May 2021 09:55:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lgP79-0000o8-4z
 for xen-changelog@lists.xenproject.org; Tue, 11 May 2021 09:55:43 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=HynU4i9AB6+Z0KpT5XOEMuSVTClVZetrXf7twQ16mSU=; b=TCwhyUMIB2etOrccKzEBkomqMC
	jlMAk8wuAoMqxq8PolWrkgGrhvCDHCrMSijaLKJxcQt9ldERgWfcVY0o1raSlrh2nfVjh7sDaiOPO
	vABB+NPuQEDMJg8XBkrFsgFyNw7wtCyT9bVAvz282acI//4RjnQAGQHQK/SHSYCaBlUM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] vtpmmgr: Support GetRandom passthrough on TPM 2.0
Message-Id: <E1lgP79-0000o8-4z@xenbits.xenproject.org>
Date: Tue, 11 May 2021 09:55:43 +0000

commit 64d00dd126b3dfa4370805f1dc3d7c1ddb6a130d
Author:     Jason Andryuk <jandryuk@gmail.com>
AuthorDate: Thu May 6 09:59:19 2021 -0400
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon May 10 14:50:27 2021 +0100

    vtpmmgr: Support GetRandom passthrough on TPM 2.0
    
    GetRandom passthrough currently fails when using vtpmmgr with a hardware
    TPM 2.0.
    vtpmmgr (8): INFO[VTPM]: Passthrough: TPM_GetRandom
    vtpm (12): vtpm_cmd.c:120: Error: TPM_GetRandom() failed with error code (30)
    
    When running on TPM 2.0 hardware, vtpmmgr needs to convert the TPM 1.2
    TPM_ORD_GetRandom into a TPM2 TPM_CC_GetRandom command.  Besides the
    differing ordinal, the TPM 1.2 uses 32bit sizes for the request and
    response (vs. 16bit for TPM2).
    
    Place the random output directly into the tpmcmd->resp and build the
    packet around it.  This avoids bouncing through an extra buffer, but the
    header has to be written after grabbing the random bytes so we have the
    number of bytes to include in the size.
    
    Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
    Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
    Reviewed by: Daniel P. Smith <dpsmith@apertussolutions.com>
---
 stubdom/vtpmmgr/marshal.h          | 15 ++++++++++
 stubdom/vtpmmgr/vtpm_cmd_handler.c | 61 +++++++++++++++++++++++++++++++++++++-
 2 files changed, 75 insertions(+), 1 deletion(-)

diff --git a/stubdom/vtpmmgr/marshal.h b/stubdom/vtpmmgr/marshal.h
index dce19c6439..f1037a7976 100644
--- a/stubdom/vtpmmgr/marshal.h
+++ b/stubdom/vtpmmgr/marshal.h
@@ -890,6 +890,15 @@ inline int sizeof_TPM_AUTH_SESSION(const TPM_AUTH_SESSION* auth) {
 	return rv;
 }
 
+static
+inline int sizeof_TPM_RQU_HEADER(BYTE* ptr) {
+	int rv = 0;
+	rv += sizeof_UINT16(ptr);
+	rv += sizeof_UINT32(ptr);
+	rv += sizeof_UINT32(ptr);
+	return rv;
+}
+
 static
 inline BYTE* pack_TPM_RQU_HEADER(BYTE* ptr,
 		TPM_TAG tag,
@@ -920,8 +929,14 @@ inline int unpack3_TPM_RQU_HEADER(BYTE* ptr, UINT32* pos, UINT32 max,
 		unpack3_UINT32(ptr, pos, max, ord);
 }
 
+static
+inline int sizeof_TPM_RQU_GetRandom(BYTE* ptr) {
+	return sizeof_TPM_RQU_HEADER(ptr) + sizeof_UINT32(ptr);
+}
+
 #define pack_TPM_RSP_HEADER(p, t, s, r) pack_TPM_RQU_HEADER(p, t, s, r)
 #define unpack_TPM_RSP_HEADER(p, t, s, r) unpack_TPM_RQU_HEADER(p, t, s, r)
 #define unpack3_TPM_RSP_HEADER(p, l, m, t, s, r) unpack3_TPM_RQU_HEADER(p, l, m, t, s, r)
+#define sizeof_TPM_RSP_HEADER(p) sizeof_TPM_RQU_HEADER(p)
 
 #endif
diff --git a/stubdom/vtpmmgr/vtpm_cmd_handler.c b/stubdom/vtpmmgr/vtpm_cmd_handler.c
index 2ac14fae77..c879b24c13 100644
--- a/stubdom/vtpmmgr/vtpm_cmd_handler.c
+++ b/stubdom/vtpmmgr/vtpm_cmd_handler.c
@@ -47,6 +47,7 @@
 #include "vtpm_disk.h"
 #include "vtpmmgr.h"
 #include "tpm.h"
+#include "tpm2.h"
 #include "tpmrsa.h"
 #include "tcg.h"
 #include "mgmt_authority.h"
@@ -772,6 +773,64 @@ static int vtpmmgr_permcheck(struct tpm_opaque *opq)
 	return 1;
 }
 
+TPM_RESULT vtpmmgr_handle_getrandom(struct tpm_opaque *opaque,
+				    tpmcmd_t* tpmcmd)
+{
+	TPM_RESULT status = TPM_SUCCESS;
+	TPM_TAG tag;
+	UINT32 size;
+	const int max_rand_size = TCPA_MAX_BUFFER_LENGTH -
+				  sizeof_TPM_RQU_GetRandom(tpmcmd->req);
+	UINT32 rand_offset;
+	UINT32 rand_size;
+	TPM_COMMAND_CODE ord;
+	BYTE *p;
+
+	if (tpmcmd->req_len != sizeof_TPM_RQU_GetRandom(tpmcmd->req)) {
+		status = TPM_BAD_PARAMETER;
+		tag = TPM_TAG_RQU_COMMAND;
+		goto abort_egress;
+	}
+
+	p = unpack_TPM_RQU_HEADER(tpmcmd->req, &tag, &size, &ord);
+
+	if (!hw_is_tpm2()) {
+		size = TCPA_MAX_BUFFER_LENGTH;
+		TPMTRYRETURN(TPM_TransmitData(tpmcmd->req, tpmcmd->req_len,
+					      tpmcmd->resp, &size));
+		tpmcmd->resp_len = size;
+
+		return TPM_SUCCESS;
+	}
+
+	/* TPM_GetRandom req: <header><uint32 num bytes> */
+	unpack_UINT32(p, &rand_size);
+
+	/* Returning fewer bytes is acceptable per the spec. */
+	if (rand_size > max_rand_size)
+		rand_size = max_rand_size;
+
+	/* Call TPM2_GetRandom but return a TPM_GetRandom response. */
+	/* TPM_GetRandom resp: <header><uint32 num bytes><num random bytes> */
+	rand_offset = sizeof_TPM_RSP_HEADER(tpmcmd->resp) +
+		      sizeof_UINT32(tpmcmd->resp);
+
+	TPMTRYRETURN(TPM2_GetRandom(&rand_size, tpmcmd->resp + rand_offset));
+
+	p = pack_TPM_RSP_HEADER(tpmcmd->resp, TPM_TAG_RSP_COMMAND,
+				rand_offset + rand_size, status);
+	p = pack_UINT32(p, rand_size);
+	tpmcmd->resp_len = rand_offset + rand_size;
+
+	return status;
+
+abort_egress:
+	tpmcmd->resp_len = VTPM_COMMAND_HEADER_SIZE;
+	pack_TPM_RSP_HEADER(tpmcmd->resp, tag + 3, tpmcmd->resp_len, status);
+
+	return status;
+}
+
 TPM_RESULT vtpmmgr_handle_cmd(
 		struct tpm_opaque *opaque,
 		tpmcmd_t* tpmcmd)
@@ -842,7 +901,7 @@ TPM_RESULT vtpmmgr_handle_cmd(
 		switch(ord) {
 		case TPM_ORD_GetRandom:
 			vtpmloginfo(VTPM_LOG_VTPM, "Passthrough: TPM_GetRandom\n");
-			break;
+			return vtpmmgr_handle_getrandom(opaque, tpmcmd);
 		case TPM_ORD_PcrRead:
 			vtpmloginfo(VTPM_LOG_VTPM, "Passthrough: TPM_PcrRead\n");
 			// Quotes also need to be restricted to hide PCR values
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue May 11 09:55:54 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 11 May 2021 09:55:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.125719.236638 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lgP7K-0003em-SJ; Tue, 11 May 2021 09:55:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 125719.236638; Tue, 11 May 2021 09:55:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lgP7K-0003ee-P4; Tue, 11 May 2021 09:55:54 +0000
Received: by outflank-mailman (input) for mailman id 125719;
 Tue, 11 May 2021 09:55:53 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lgP7J-0003eQ-9v
 for xen-changelog@lists.xenproject.org; Tue, 11 May 2021 09:55:53 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lgP7J-000145-9G
 for xen-changelog@lists.xenproject.org; Tue, 11 May 2021 09:55:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lgP7J-0000or-8S
 for xen-changelog@lists.xenproject.org; Tue, 11 May 2021 09:55:53 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=PhWhtaqq2+PXcFUSrXZHQ54Hpn/hvprjhrbHCwpvWSM=; b=2MnZz/MQigdX7PRRgpvR02pdYy
	myyo+HAaxyLTIjSb7btqfRwAcu3sxaCgHwHMuFxbw987UkdT9/I2FcKtO217NNY0CDluIyHjHvE4r
	acSj7vay4m0Hy3oZVBHqrk4ep5cP/YDV3Lf7tWflFfsq9mZ0266kXwvFdWzCmfRFtVBA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] vtpmmgr: Remove bogus cast from TPM2_GetRandom
Message-Id: <E1lgP7J-0000or-8S@xenbits.xenproject.org>
Date: Tue, 11 May 2021 09:55:53 +0000

commit 7f4276fad8f0bfba5bb3fd012bf2df51c05fcf02
Author:     Jason Andryuk <jandryuk@gmail.com>
AuthorDate: Thu May 6 09:59:20 2021 -0400
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon May 10 14:50:33 2021 +0100

    vtpmmgr: Remove bogus cast from TPM2_GetRandom
    
    The UINT32 <-> UINT16 casting in TPM2_GetRandom is incorrect.  Use a
    local UINT16 as needed for the TPM hardware command and assign the
    result.
    
    Suggested-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
    Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
    Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
    Reviewed-by: Daniel P. Smith <dpsmith@apertussolutions.com>
---
 stubdom/vtpmmgr/tpm2.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/stubdom/vtpmmgr/tpm2.c b/stubdom/vtpmmgr/tpm2.c
index 655e6d164c..ebd06eac74 100644
--- a/stubdom/vtpmmgr/tpm2.c
+++ b/stubdom/vtpmmgr/tpm2.c
@@ -427,15 +427,22 @@ abort_egress:
 
 TPM_RC TPM2_GetRandom(UINT32 * bytesRequested, BYTE * randomBytes)
 {
+    UINT16 bytesReq;
     TPM_BEGIN(TPM_ST_NO_SESSIONS, TPM_CC_GetRandom);
 
-    ptr = pack_UINT16(ptr, (UINT16)*bytesRequested);
+    if (*bytesRequested > UINT16_MAX)
+        bytesReq = UINT16_MAX;
+    else
+        bytesReq = *bytesRequested;
+
+    ptr = pack_UINT16(ptr, bytesReq);
 
     TPM_TRANSMIT();
     TPM_UNPACK_VERIFY();
 
-    ptr = unpack_UINT16(ptr, (UINT16 *)bytesRequested);
-    ptr = unpack_TPM_BUFFER(ptr, randomBytes, *bytesRequested);
+    ptr = unpack_UINT16(ptr, &bytesReq);
+    *bytesRequested = bytesReq;
+    ptr = unpack_TPM_BUFFER(ptr, randomBytes, bytesReq);
 
 abort_egress:
     return status;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue May 11 09:56:04 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 11 May 2021 09:56:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.125720.236641 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lgP7U-0003hi-TX; Tue, 11 May 2021 09:56:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 125720.236641; Tue, 11 May 2021 09:56:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lgP7U-0003ha-Qd; Tue, 11 May 2021 09:56:04 +0000
Received: by outflank-mailman (input) for mailman id 125720;
 Tue, 11 May 2021 09:56:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lgP7T-0003hE-Cx
 for xen-changelog@lists.xenproject.org; Tue, 11 May 2021 09:56:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lgP7T-00014M-CA
 for xen-changelog@lists.xenproject.org; Tue, 11 May 2021 09:56:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lgP7T-0000q2-BH
 for xen-changelog@lists.xenproject.org; Tue, 11 May 2021 09:56:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=s9JM4hOm9zw/yE6BtsVgITLARFpn8omiqt3h33AMqBo=; b=cBCw83wfWqHk/LME1kAzxHydFP
	Rdbojom0dIzn7oS7PFZVkCBWljmg5ZO+pIm9S8XkmCFUv7JgT0Zb3s4GS9y7hphnHiXS+yVAOH5m9
	nyiH4phK5jnkZ++lKizyOfFBXkk0NBBMTM2CWZckRDXi4u2FX3vY2lKymBEf5g//zXKQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] vtpmmgr: Fix owner_auth & srk_auth parsing
Message-Id: <E1lgP7T-0000q2-BH@xenbits.xenproject.org>
Date: Tue, 11 May 2021 09:56:03 +0000

commit c8d8a1e2e6a1fdba45dd9e9fb993d79d1e5a097c
Author:     Jason Andryuk <jandryuk@gmail.com>
AuthorDate: Thu May 6 09:59:21 2021 -0400
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon May 10 14:50:33 2021 +0100

    vtpmmgr: Fix owner_auth & srk_auth parsing
    
    Argument parsing only matches to before ':' and then the string with
    leading ':' is passed to parse_auth_string which fails to parse.  Extend
    the length to include the seperator in the match.
    
    While here, switch the seperator to "=".  The man page documented "="
    and the other tpm.* arguments already use "=".  Since it didn't work
    before, we don't need to worry about backwards compatibility.
    
    Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
    Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
    Reviewed-by: Daniel P. Smith <dpsmith@apertussolutions.com>
---
 stubdom/vtpmmgr/init.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/stubdom/vtpmmgr/init.c b/stubdom/vtpmmgr/init.c
index 4ae34a4fcb..62dc5994de 100644
--- a/stubdom/vtpmmgr/init.c
+++ b/stubdom/vtpmmgr/init.c
@@ -289,16 +289,16 @@ int parse_cmdline_opts(int argc, char** argv, struct Opts* opts)
    memcpy(vtpm_globals.srk_auth, WELLKNOWN_AUTH, sizeof(TPM_AUTHDATA));
 
    for(i = 1; i < argc; ++i) {
-      if(!strncmp(argv[i], "owner_auth:", 10)) {
-         if((rc = parse_auth_string(argv[i] + 10, vtpm_globals.owner_auth)) < 0) {
+      if(!strncmp(argv[i], "owner_auth=", 11)) {
+         if((rc = parse_auth_string(argv[i] + 11, vtpm_globals.owner_auth)) < 0) {
             goto err_invalid;
          }
          if(rc == 1) {
             opts->gen_owner_auth = 1;
          }
       }
-      else if(!strncmp(argv[i], "srk_auth:", 8)) {
-         if((rc = parse_auth_string(argv[i] + 8, vtpm_globals.srk_auth)) != 0) {
+      else if(!strncmp(argv[i], "srk_auth=", 9)) {
+         if((rc = parse_auth_string(argv[i] + 9, vtpm_globals.srk_auth)) != 0) {
             goto err_invalid;
          }
       }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue May 11 09:56:14 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 11 May 2021 09:56:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.125721.236646 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lgP7e-0003ky-VB; Tue, 11 May 2021 09:56:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 125721.236646; Tue, 11 May 2021 09:56:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lgP7e-0003kq-SA; Tue, 11 May 2021 09:56:14 +0000
Received: by outflank-mailman (input) for mailman id 125721;
 Tue, 11 May 2021 09:56:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lgP7d-0003kd-Fi
 for xen-changelog@lists.xenproject.org; Tue, 11 May 2021 09:56:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lgP7d-00014V-Ey
 for xen-changelog@lists.xenproject.org; Tue, 11 May 2021 09:56:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lgP7d-0000qd-EF
 for xen-changelog@lists.xenproject.org; Tue, 11 May 2021 09:56:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Y2OBQd564fVwjl/4bPk7B4VsujTdGCIWFKygOJOP4uM=; b=p/MzzXU5I8jKkHyrCDRFCsdayt
	U5ToNoTwuAHbKC9mLgPg7qYe7/eQGT3ueNJ5R2/JAJFBfGyddf+xDz+xzHRfrdcYGeN0sJFI8KkH2
	l4PQ8GJHom6weGeT11+Vg0kRAC526qApgxRHYT3a2LBJAk8UWuvSE80oel6UHZ0dhxuc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] vtpmmgr: Check req_len before unpacking command
Message-Id: <E1lgP7d-0000qd-EF@xenbits.xenproject.org>
Date: Tue, 11 May 2021 09:56:13 +0000

commit 5974702bddd37445ae2104f567d88c400227d5d4
Author:     Jason Andryuk <jandryuk@gmail.com>
AuthorDate: Thu May 6 09:59:22 2021 -0400
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon May 10 14:50:33 2021 +0100

    vtpmmgr: Check req_len before unpacking command
    
    vtpm_handle_cmd doesn't ensure there is enough space before unpacking
    the req buffer.  Add a minimum size check.  Called functions will have
    to do their own checking if they need more data from the request.
    
    The error case is tricky since abort_egress wants to rely with a
    corresponding tag.  Just hardcode TPM_TAG_RQU_COMMAND since the vtpm is
    sending in malformed commands in the first place.
    
    Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
    Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
    Reviewed-by: Daniel P. Smith <dpsmith@apertussolutions.com>
---
 stubdom/vtpmmgr/vtpm_cmd_handler.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/stubdom/vtpmmgr/vtpm_cmd_handler.c b/stubdom/vtpmmgr/vtpm_cmd_handler.c
index c879b24c13..5586be6997 100644
--- a/stubdom/vtpmmgr/vtpm_cmd_handler.c
+++ b/stubdom/vtpmmgr/vtpm_cmd_handler.c
@@ -840,6 +840,12 @@ TPM_RESULT vtpmmgr_handle_cmd(
 	UINT32 size;
 	TPM_COMMAND_CODE ord;
 
+	if (tpmcmd->req_len < sizeof_TPM_RQU_HEADER(tpmcmd->req)) {
+		status = TPM_BAD_PARAMETER;
+		tag = TPM_TAG_RQU_COMMAND;
+		goto abort_egress;
+	}
+
 	unpack_TPM_RQU_HEADER(tpmcmd->req,
 			&tag, &size, &ord);
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue May 11 09:56:25 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 11 May 2021 09:56:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.125722.236650 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lgP7p-0003o4-0c; Tue, 11 May 2021 09:56:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 125722.236650; Tue, 11 May 2021 09:56:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lgP7o-0003nw-Tu; Tue, 11 May 2021 09:56:24 +0000
Received: by outflank-mailman (input) for mailman id 125722;
 Tue, 11 May 2021 09:56:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lgP7n-0003nk-Ie
 for xen-changelog@lists.xenproject.org; Tue, 11 May 2021 09:56:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lgP7n-00014a-Hv
 for xen-changelog@lists.xenproject.org; Tue, 11 May 2021 09:56:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lgP7n-0000rK-H4
 for xen-changelog@lists.xenproject.org; Tue, 11 May 2021 09:56:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=6twz2avLKGXLlV9QME4ve8Y8tsNmHPqb8Uz/shhuxFM=; b=C+ci/IfWq6WmA8m1oSfkHANCCR
	mdy1gbyx5QJyZY7VP12fswOa57TXrhVE16ZuKmDUxUHqLt82d3TrxjnICseJ6OK8niPTF8RTMyVr5
	QJH8A0aCq85u3WJVRjHewXOrAeN02z2q1envIYwHVy6UFaGOXj2gpUpW9WPLDZAc3o30=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] vtpm: Correct timeout units and command duration
Message-Id: <E1lgP7n-0000rK-H4@xenbits.xenproject.org>
Date: Tue, 11 May 2021 09:56:23 +0000

commit fdff034b0710587d8cfe979e7e42c0acd848bc7a
Author:     Jason Andryuk <jandryuk@gmail.com>
AuthorDate: Thu May 6 09:59:23 2021 -0400
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon May 10 14:50:33 2021 +0100

    vtpm: Correct timeout units and command duration
    
    Add two patches:
    vtpm-microsecond-duration.patch fixes the units for timeouts and command
    durations.
    vtpm-command-duration.patch increases the timeout linux uses to allow
    commands to succeed.
    
    Linux works around low timeouts, but not low durations.  The second
    patch allows commands to complete that often timeout with the lower
    command durations.
    
    Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
    Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
    Reviewed-by: Daniel P. Smith <dpsmith@apertussolutions.com>
---
 stubdom/Makefile                        |  2 ++
 stubdom/vtpm-command-duration.patch     | 52 +++++++++++++++++++++++++++++++++
 stubdom/vtpm-microsecond-duration.patch | 52 +++++++++++++++++++++++++++++++++
 3 files changed, 106 insertions(+)

diff --git a/stubdom/Makefile b/stubdom/Makefile
index c6de5f68ae..06aa69d8bc 100644
--- a/stubdom/Makefile
+++ b/stubdom/Makefile
@@ -239,6 +239,8 @@ tpm_emulator-$(XEN_TARGET_ARCH): tpm_emulator-$(TPMEMU_VERSION).tar.gz
 	patch -d $@ -p1 < vtpm-implicit-fallthrough.patch
 	patch -d $@ -p1 < vtpm_TPM_ChangeAuthAsymFinish.patch
 	patch -d $@ -p1 < vtpm_extern.patch
+	patch -d $@ -p1 < vtpm-microsecond-duration.patch
+	patch -d $@ -p1 < vtpm-command-duration.patch
 	mkdir $@/build
 	cd $@/build; CC=${CC} $(CMAKE) .. -DCMAKE_C_FLAGS:STRING="-std=c99 -DTPM_NO_EXTERN $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) -Wno-declaration-after-statement"
 	touch $@
diff --git a/stubdom/vtpm-command-duration.patch b/stubdom/vtpm-command-duration.patch
new file mode 100644
index 0000000000..6fdf2fc9be
--- /dev/null
+++ b/stubdom/vtpm-command-duration.patch
@@ -0,0 +1,52 @@
+From e7c976b5864e7d2649292d90ea60d5aea091a990 Mon Sep 17 00:00:00 2001
+From: Jason Andryuk <jandryuk@gmail.com>
+Date: Sun, 14 Mar 2021 12:46:34 -0400
+Subject: [PATCH 2/2] Increase command durations
+
+Wth Linux 5.4 xen-tpmfront and a Xen vtpm-stubdom, xen-tpmfront was
+failing commands with -ETIME:
+tpm tpm0: tpm_try_transmit: send(): error-62
+
+The vtpm was returning the data, but it was after the duration timeout
+in vtpm_send.  Linux may have started being more stringent about timing?
+
+The vtpm-stubdom has a little delay since it writes its disk before
+returning the response.
+
+Anyway, the durations are rather low.  When they were 1/10/1000 before
+converting to microseconds, Linux showed all three durations rounded to
+10000.  Update them with values from a physical TPM1.2.  These were
+taken from a WEC which was software downgraded from a TPM2 to a TPM1.2.
+They might be excessive, but I'd rather have a command succeed than
+return -ETIME.
+
+An IFX physical TPM1.2 uses:
+1000000
+1500000
+150000000
+
+Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
+---
+ tpm/tpm_data.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/tpm/tpm_data.c b/tpm/tpm_data.c
+index bebaf10..844afca 100644
+--- a/tpm/tpm_data.c
++++ b/tpm/tpm_data.c
+@@ -71,9 +71,9 @@ static void init_timeouts(void)
+   tpmData.permanent.data.tis_timeouts[1] = 2000000;
+   tpmData.permanent.data.tis_timeouts[2] = 750000;
+   tpmData.permanent.data.tis_timeouts[3] = 750000;
+-  tpmData.permanent.data.cmd_durations[0] = 1000;
+-  tpmData.permanent.data.cmd_durations[1] = 10000;
+-  tpmData.permanent.data.cmd_durations[2] = 1000000;
++  tpmData.permanent.data.cmd_durations[0] = 3000000;
++  tpmData.permanent.data.cmd_durations[1] = 3000000;
++  tpmData.permanent.data.cmd_durations[2] = 600000000;
+ }
+ 
+ void tpm_init_data(void)
+-- 
+2.30.2
+
diff --git a/stubdom/vtpm-microsecond-duration.patch b/stubdom/vtpm-microsecond-duration.patch
new file mode 100644
index 0000000000..7a906e72c5
--- /dev/null
+++ b/stubdom/vtpm-microsecond-duration.patch
@@ -0,0 +1,52 @@
+From 5a510e0afd7c288e3f0fb3523ec749ba1366ad61 Mon Sep 17 00:00:00 2001
+From: Jason Andryuk <jandryuk@gmail.com>
+Date: Sun, 14 Mar 2021 12:42:10 -0400
+Subject: [PATCH 1/2] Use microseconds for timeouts and durations
+
+The timeout and duration fields should be in microseconds according to
+the spec.
+
+TPM_CAP_PROP_TIS_TIMEOUT:
+A 4 element array of UINT32 values each denoting the timeout value in
+microseconds for the following in this order:
+
+TPM_CAP_PROP_DURATION:
+A 3 element array of UINT32 values each denoting the duration value in
+microseconds of the duration of the three classes of commands:
+
+Linux will scale the timeouts up by 1000, but not the durations.  Change
+the units for both sets as appropriate.
+
+Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
+---
+ tpm/tpm_data.c | 14 +++++++-------
+ 1 file changed, 7 insertions(+), 7 deletions(-)
+
+diff --git a/tpm/tpm_data.c b/tpm/tpm_data.c
+index a3a79ef..bebaf10 100644
+--- a/tpm/tpm_data.c
++++ b/tpm/tpm_data.c
+@@ -67,13 +67,13 @@ static void init_nv_storage(void)
+ static void init_timeouts(void)
+ {
+   /* for the timeouts we use the PC platform defaults */
+-  tpmData.permanent.data.tis_timeouts[0] = 750;
+-  tpmData.permanent.data.tis_timeouts[1] = 2000;
+-  tpmData.permanent.data.tis_timeouts[2] = 750;
+-  tpmData.permanent.data.tis_timeouts[3] = 750;
+-  tpmData.permanent.data.cmd_durations[0] = 1;
+-  tpmData.permanent.data.cmd_durations[1] = 10;
+-  tpmData.permanent.data.cmd_durations[2] = 1000;
++  tpmData.permanent.data.tis_timeouts[0] = 750000;
++  tpmData.permanent.data.tis_timeouts[1] = 2000000;
++  tpmData.permanent.data.tis_timeouts[2] = 750000;
++  tpmData.permanent.data.tis_timeouts[3] = 750000;
++  tpmData.permanent.data.cmd_durations[0] = 1000;
++  tpmData.permanent.data.cmd_durations[1] = 10000;
++  tpmData.permanent.data.cmd_durations[2] = 1000000;
+ }
+ 
+ void tpm_init_data(void)
+-- 
+2.30.2
+
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue May 11 09:56:35 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 11 May 2021 09:56:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.125723.236654 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lgP7z-0003r0-2i; Tue, 11 May 2021 09:56:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 125723.236654; Tue, 11 May 2021 09:56:35 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lgP7y-0003qq-VV; Tue, 11 May 2021 09:56:34 +0000
Received: by outflank-mailman (input) for mailman id 125723;
 Tue, 11 May 2021 09:56:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lgP7x-0003qd-Lw
 for xen-changelog@lists.xenproject.org; Tue, 11 May 2021 09:56:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lgP7x-000156-LE
 for xen-changelog@lists.xenproject.org; Tue, 11 May 2021 09:56:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lgP7x-0000sO-K1
 for xen-changelog@lists.xenproject.org; Tue, 11 May 2021 09:56:33 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=8MTdUxo2WTxoZHn7trVqYrzK5aA2l/v+B4BmW7nrdHw=; b=K8UB8unbT01KA8y0EOsJ6P/Nre
	0zr2HlK1Dkc0dzVLmNHX4WgoPnmEE1QAFGvyF7rc+8kcut9bBuIj5KzB+vS+4rdqub9B/WHpYNxCI
	6bjsmpbJERjJM9SyhIVKW50+PuTyIEFiVUkoiIJtTFDpFaaOyCvO2+k+JxpYfrtj5w5s=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools: add newlines to xenstored WRL_LOG
Message-Id: <E1lgP7x-0000sO-K1@xenbits.xenproject.org>
Date: Tue, 11 May 2021 09:56:33 +0000

commit 982c89ed527bc5b0ffae5da9fd33f9d2d1528f06
Author:     Olaf Hering <olaf@aepfle.de>
AuthorDate: Mon May 3 17:47:12 2021 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon May 10 14:51:52 2021 +0100

    tools: add newlines to xenstored WRL_LOG
    
    According to syslog(3) the fmt string does not need a newline.
    The mini-os implementation of syslog requires the trailing newline.
    Other calls to syslog do include the newline already, add it also to WRL_LOG.
    
    Signed-off-by: Olaf Hering <olaf@aepfle.de>
    Reviewed-by: Juergen Gross <jgross@suse.com>
---
 tools/xenstore/xenstored_domain.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/xenstore/xenstored_domain.c b/tools/xenstore/xenstored_domain.c
index 3d4d0649a2..2d333b3ff6 100644
--- a/tools/xenstore/xenstored_domain.c
+++ b/tools/xenstore/xenstored_domain.c
@@ -1132,10 +1132,10 @@ void wrl_apply_debit_actual(struct domain *domain)
 	if (domain->wrl_credit < 0) {
 		if (!domain->wrl_delay_logged) {
 			domain->wrl_delay_logged = true;
-			WRL_LOG(now, "domain %ld is affected",
+			WRL_LOG(now, "domain %ld is affected\n",
 				(long)domain->domid);
 		} else if (!wrl_log_last_warning) {
-			WRL_LOG(now, "rate limiting restarts");
+			WRL_LOG(now, "rate limiting restarts\n");
 		}
 		wrl_log_last_warning = now.sec;
 	}
@@ -1145,7 +1145,7 @@ void wrl_log_periodic(struct wrl_timestampt now)
 {
 	if (wrl_log_last_warning &&
 	    (now.sec - wrl_log_last_warning) > WRL_LOGEVERY) {
-		WRL_LOG(now, "not in force recently");
+		WRL_LOG(now, "not in force recently\n");
 		wrl_log_last_warning = 0;
 	}
 }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed May 12 15:33:11 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 May 2021 15:33:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.126308.237777 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lgqrB-0003Ka-Q0; Wed, 12 May 2021 15:33:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 126308.237777; Wed, 12 May 2021 15:33:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lgqrB-0003KS-MF; Wed, 12 May 2021 15:33:05 +0000
Received: by outflank-mailman (input) for mailman id 126308;
 Wed, 12 May 2021 15:33:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lgqrB-0003KM-7O
 for xen-changelog@lists.xenproject.org; Wed, 12 May 2021 15:33:05 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lgqrB-0005Ya-3m
 for xen-changelog@lists.xenproject.org; Wed, 12 May 2021 15:33:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lgqrB-0003rn-2j
 for xen-changelog@lists.xenproject.org; Wed, 12 May 2021 15:33:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=f1GrdszrkdNymMvWP4McQr60Zu2oPemW9NiR17V/k1o=; b=ArwVfN06H2vYDAC4GmGwEajt8z
	ucCdw8RE4SsjzqiguN/XFaTaMxg/WeU5Dw6MtXFkEAe01aI4e/kAJtxWV2/86Lmn2Jg1ieibBF9Bz
	F6YbZJ7aT0sCwbQvbidiPs5kjMHNWBHft8oJLe8XuP46lgoZyOwx1dWoiHoG4iz4uw5w=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools: remove unused sysconfig variable XENSTORED_ROOTDIR
Message-Id: <E1lgqrB-0003rn-2j@xenbits.xenproject.org>
Date: Wed, 12 May 2021 15:33:05 +0000

commit 52b91dad6f43afb0c77325e6d54115c280958e57
Author:     Olaf Hering <olaf@aepfle.de>
AuthorDate: Thu May 6 17:16:31 2021 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed May 12 16:25:44 2021 +0100

    tools: remove unused sysconfig variable XENSTORED_ROOTDIR
    
    The sysconfig variable XENSTORED_ROOTDIR is not used anymore.
    It used to point to a directory with tdb files, which is now a tmpfs.
    
    In case the database is not in tmpfs, like on sysv and BSD systems,
    xenstored will truncate existing database files during start.
    
    Fixes: 2ef6ace428 ("tools: don't remove tdb data base file before starting xenstored")
    Signed-off-by: Olaf Hering <olaf@aepfle.de>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Wei Liu <wl@xen.org>
---
 CHANGELOG.md                                       | 4 ++++
 tools/hotplug/FreeBSD/rc.d/xencommons.in           | 5 -----
 tools/hotplug/Linux/init.d/sysconfig.xencommons.in | 7 -------
 tools/hotplug/Linux/launch-xenstore.in             | 1 -
 tools/hotplug/NetBSD/rc.d/xencommons.in            | 5 -----
 5 files changed, 4 insertions(+), 18 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0106fccec1..6896d70757 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
 
 ## [unstable UNRELEASED](https://xenbits.xen.org/gitweb/?p=xen.git;a=shortlog;h=staging) - TBD
 
+### Removed
+ - XENSTORED_ROOTDIR environment variable from configuartion files and
+   initscripts, due to being unused.
+
 ## [4.15.0 UNRELEASED](https://xenbits.xen.org/gitweb/?p=xen.git;a=shortlog;h=RELEASE-4.15.0) - TBD
 
 ### Added / support upgraded
diff --git a/tools/hotplug/FreeBSD/rc.d/xencommons.in b/tools/hotplug/FreeBSD/rc.d/xencommons.in
index 4c61d8c94e..fddcce314c 100644
--- a/tools/hotplug/FreeBSD/rc.d/xencommons.in
+++ b/tools/hotplug/FreeBSD/rc.d/xencommons.in
@@ -42,11 +42,6 @@ xen_startcmd()
 
 	xenstored_pid=$(check_pidfile ${XENSTORED_PIDFILE} ${XENSTORED})
 	if test -z "$xenstored_pid"; then
-		printf "Cleaning xenstore database.\n"
-		if [ -z "${XENSTORED_ROOTDIR}" ]; then
-			XENSTORED_ROOTDIR="@XEN_LIB_STORED@"
-		fi
-		rm -f ${XENSTORED_ROOTDIR}/tdb* >/dev/null 2>&1
 		printf "Starting xenservices: xenstored, xenconsoled."
 		XENSTORED_ARGS=" --pid-file ${XENSTORED_PIDFILE}"
 		if [ -n "${XENSTORED_TRACE}" ]; then
diff --git a/tools/hotplug/Linux/init.d/sysconfig.xencommons.in b/tools/hotplug/Linux/init.d/sysconfig.xencommons.in
index b059a2910d..00cf7f91d4 100644
--- a/tools/hotplug/Linux/init.d/sysconfig.xencommons.in
+++ b/tools/hotplug/Linux/init.d/sysconfig.xencommons.in
@@ -48,13 +48,6 @@ XENSTORED_ARGS=
 # Only evaluated if XENSTORETYPE is "daemon".
 #XENSTORED_TRACE=[yes|on|1]
 
-## Type: string
-## Default: "@XEN_LIB_STORED@"
-#
-# Running xenstored on XENSTORED_ROOTDIR
-# Only evaluated if XENSTORETYPE is "daemon".
-#XENSTORED_ROOTDIR=@XEN_LIB_STORED@
-
 ## Type: string
 ## Default: @LIBEXEC@/boot/xenstore-stubdom.gz
 #
diff --git a/tools/hotplug/Linux/launch-xenstore.in b/tools/hotplug/Linux/launch-xenstore.in
index 991dec8d25..019f9d6f4d 100644
--- a/tools/hotplug/Linux/launch-xenstore.in
+++ b/tools/hotplug/Linux/launch-xenstore.in
@@ -53,7 +53,6 @@ test -f @CONFIG_DIR@/@CONFIG_LEAF_DIR@/xencommons && . @CONFIG_DIR@/@CONFIG_LEAF
 /bin/mkdir -p @XEN_RUN_DIR@
 
 [ "$XENSTORETYPE" = "daemon" ] && {
-	[ -z "$XENSTORED_ROOTDIR" ] && XENSTORED_ROOTDIR="@XEN_LIB_STORED@"
 	[ -z "$XENSTORED_TRACE" ] || XENSTORED_ARGS="$XENSTORED_ARGS -T @XEN_LOG_DIR@/xenstored-trace.log"
 	[ -z "$XENSTORED" ] && XENSTORED=@XENSTORED@
 	[ -x "$XENSTORED" ] || {
diff --git a/tools/hotplug/NetBSD/rc.d/xencommons.in b/tools/hotplug/NetBSD/rc.d/xencommons.in
index 80e518f5de..cf2af06596 100644
--- a/tools/hotplug/NetBSD/rc.d/xencommons.in
+++ b/tools/hotplug/NetBSD/rc.d/xencommons.in
@@ -38,11 +38,6 @@ xen_startcmd()
 
 	xenstored_pid=$(check_pidfile ${XENSTORED_PIDFILE} ${sbindir}/xenstored)
 	if test -z "$xenstored_pid"; then
-		printf "Cleaning xenstore database.\n"
-		if [ -z "${XENSTORED_ROOTDIR}" ]; then
-			XENSTORED_ROOTDIR="@XEN_LIB_STORED@"
-		fi
-		rm -f ${XENSTORED_ROOTDIR}/tdb* >/dev/null 2>&1
 		printf "Starting xenservices: xenstored, xenconsoled."
 		XENSTORED_ARGS=" --pid-file ${XENSTORED_PIDFILE}"
 		if [ -n "${XENSTORED_TRACE}" ]; then
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed May 12 20:33:13 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 May 2021 20:33:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.126396.237955 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lgvXW-00013h-Vn; Wed, 12 May 2021 20:33:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 126396.237955; Wed, 12 May 2021 20:33:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lgvXW-00013Z-Sq; Wed, 12 May 2021 20:33:06 +0000
Received: by outflank-mailman (input) for mailman id 126396;
 Wed, 12 May 2021 20:33:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lgvXV-00013T-2r
 for xen-changelog@lists.xenproject.org; Wed, 12 May 2021 20:33:05 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lgvXU-0002uw-Vy
 for xen-changelog@lists.xenproject.org; Wed, 12 May 2021 20:33:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lgvXU-0006wA-UX
 for xen-changelog@lists.xenproject.org; Wed, 12 May 2021 20:33:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=DuO+B9Zw+tcb0taGtYa67w2MqNjb+kD1sSAfavNVhcA=; b=V/EZLkaVM50TIBJ9shKlJ/n1Nk
	Sv2Pmq0Y9gGZBGtFWqLIrJYyMdzoMaADfykkCjFLO11sPLBRhbC8sBHpGnZrqPL3vZIupCJznOGq3
	LOZRTC3EdNK49LlVvAYnleOKgGzy4vkCH8fZnzyC24EtVIOOnpOJqFIjAW5yDOZrdMYs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: gic-v3: Add missing breaks gicv3_read_apr()
Message-Id: <E1lgvXU-0006wA-UX@xenbits.xenproject.org>
Date: Wed, 12 May 2021 20:33:04 +0000

commit 43d4cc7d36503bcc3aa2aa6ebea2b7912808f254
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Wed May 12 18:35:48 2021 +0100
Commit:     Stefano Stabellini <sstabellini@kernel.org>
CommitDate: Wed May 12 13:23:48 2021 -0700

    xen/arm: gic-v3: Add missing breaks gicv3_read_apr()
    
    Commit 78e67c99eb3f "arm/gic: Get rid of READ/WRITE_SYSREG32"
    mistakenly converted all the cases in gicv3_read_apr() to fall-through.
    
    Rather than re-instating a return per case, add the missing break and
    keep a single return at the end of the fucntion.
    
    Fixes: 78e67c99eb3f ("arm/gic: Get rid of READ/WRITE_SYSREG32")
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/arch/arm/gic-v3.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/xen/arch/arm/gic-v3.c b/xen/arch/arm/gic-v3.c
index b86f040589..9a3a175ad7 100644
--- a/xen/arch/arm/gic-v3.c
+++ b/xen/arch/arm/gic-v3.c
@@ -1167,12 +1167,15 @@ static unsigned int gicv3_read_apr(int apr_reg)
     case 0:
         ASSERT(gicv3.nr_priorities > 4 && gicv3.nr_priorities < 8);
         apr = READ_SYSREG(ICH_AP1R0_EL2);
+        break;
     case 1:
         ASSERT(gicv3.nr_priorities > 5 && gicv3.nr_priorities < 8);
         apr = READ_SYSREG(ICH_AP1R1_EL2);
+        break;
     case 2:
         ASSERT(gicv3.nr_priorities > 6 && gicv3.nr_priorities < 8);
         apr = READ_SYSREG(ICH_AP1R2_EL2);
+        break;
     default:
         BUG();
     }
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu May 13 13:44:08 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 13 May 2021 13:44:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.126968.238573 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lhBdD-00033g-K5; Thu, 13 May 2021 13:44:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 126968.238573; Thu, 13 May 2021 13:44:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lhBdD-00033Y-H4; Thu, 13 May 2021 13:44:03 +0000
Received: by outflank-mailman (input) for mailman id 126968;
 Thu, 13 May 2021 13:44:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lhBdC-00033Q-QZ
 for xen-changelog@lists.xenproject.org; Thu, 13 May 2021 13:44:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lhBdC-000344-NT
 for xen-changelog@lists.xenproject.org; Thu, 13 May 2021 13:44:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lhBdC-0005gk-Md
 for xen-changelog@lists.xenproject.org; Thu, 13 May 2021 13:44:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=vXLMNkxVTLi4M/RYSt7nmrmUvdIcDMtWynV5EM2/UzM=; b=cupNBOJPhS9fIdmL9F8TPr7q81
	4fQa7QnDJ7DSxYyAVeVeBQbk0c6Hm2GMi7aC38gLLqfRtFDeK8XRO3gqUCgEBR0oSc7akVPrwpOG4
	/RKcX4e/nsLTwPjLPFQQg1QgMtVcSHFT2j/VwwThGhrpHRVaxZTOJksA0ybN2ba0eP6o=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] arm64/vfp: Get rid of READ/WRITE_SYSREG32
Message-Id: <E1lhBdC-0005gk-Md@xenbits.xenproject.org>
Date: Thu, 13 May 2021 13:44:02 +0000

commit 8990f0eaca139364091109389416455f4f78cd65
Author:     Michal Orzel <michal.orzel@arm.com>
AuthorDate: Wed May 5 09:42:59 2021 +0200
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Mon May 10 18:16:34 2021 +0100

    arm64/vfp: Get rid of READ/WRITE_SYSREG32
    
    AArch64 registers are 64bit whereas AArch32 registers
    are 32bit or 64bit. MSR/MRS are expecting 64bit values thus
    we should get rid of helpers READ/WRITE_SYSREG32
    in favour of using READ/WRITE_SYSREG.
    We should also use register_t type when reading sysregs
    which can correspond to uint64_t or uint32_t.
    Even though many AArch64 registers have upper 32bit reserved
    it does not mean that they can't be widen in the future.
    
    Modify type of FPCR, FPSR, FPEXC32_EL2 to register_t.
    
    Signed-off-by: Michal Orzel <michal.orzel@arm.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/arm64/vfp.c        | 12 ++++++------
 xen/include/asm-arm/arm64/vfp.h |  6 +++---
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/xen/arch/arm/arm64/vfp.c b/xen/arch/arm/arm64/vfp.c
index 999a0d58a5..47885e76ba 100644
--- a/xen/arch/arm/arm64/vfp.c
+++ b/xen/arch/arm/arm64/vfp.c
@@ -26,10 +26,10 @@ void vfp_save_state(struct vcpu *v)
                  "stp q30, q31, [%1, #16 * 30]\n\t"
                  : "=Q" (*v->arch.vfp.fpregs) : "r" (v->arch.vfp.fpregs));
 
-    v->arch.vfp.fpsr = READ_SYSREG32(FPSR);
-    v->arch.vfp.fpcr = READ_SYSREG32(FPCR);
+    v->arch.vfp.fpsr = READ_SYSREG(FPSR);
+    v->arch.vfp.fpcr = READ_SYSREG(FPCR);
     if ( is_32bit_domain(v->domain) )
-        v->arch.vfp.fpexc32_el2 = READ_SYSREG32(FPEXC32_EL2);
+        v->arch.vfp.fpexc32_el2 = READ_SYSREG(FPEXC32_EL2);
 }
 
 void vfp_restore_state(struct vcpu *v)
@@ -55,8 +55,8 @@ void vfp_restore_state(struct vcpu *v)
                  "ldp q30, q31, [%1, #16 * 30]\n\t"
                  : : "Q" (*v->arch.vfp.fpregs), "r" (v->arch.vfp.fpregs));
 
-    WRITE_SYSREG32(v->arch.vfp.fpsr, FPSR);
-    WRITE_SYSREG32(v->arch.vfp.fpcr, FPCR);
+    WRITE_SYSREG(v->arch.vfp.fpsr, FPSR);
+    WRITE_SYSREG(v->arch.vfp.fpcr, FPCR);
     if ( is_32bit_domain(v->domain) )
-        WRITE_SYSREG32(v->arch.vfp.fpexc32_el2, FPEXC32_EL2);
+        WRITE_SYSREG(v->arch.vfp.fpexc32_el2, FPEXC32_EL2);
 }
diff --git a/xen/include/asm-arm/arm64/vfp.h b/xen/include/asm-arm/arm64/vfp.h
index 6ab5d36c6c..e6e8c363bc 100644
--- a/xen/include/asm-arm/arm64/vfp.h
+++ b/xen/include/asm-arm/arm64/vfp.h
@@ -7,9 +7,9 @@
 struct vfp_state
 {
     uint64_t fpregs[64] __vfp_aligned;
-    uint32_t fpcr;
-    uint32_t fpexc32_el2;
-    uint32_t fpsr;
+    register_t fpcr;
+    register_t fpexc32_el2;
+    register_t fpsr;
 };
 
 #endif /* _ARM_ARM64_VFP_H */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu May 13 13:44:13 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 13 May 2021 13:44:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.126969.238577 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lhBdN-00037A-Lh; Thu, 13 May 2021 13:44:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 126969.238577; Thu, 13 May 2021 13:44:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lhBdN-000372-Ii; Thu, 13 May 2021 13:44:13 +0000
Received: by outflank-mailman (input) for mailman id 126969;
 Thu, 13 May 2021 13:44:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lhBdM-00036q-RU
 for xen-changelog@lists.xenproject.org; Thu, 13 May 2021 13:44:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lhBdM-00034C-Ql
 for xen-changelog@lists.xenproject.org; Thu, 13 May 2021 13:44:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lhBdM-0005hl-Pl
 for xen-changelog@lists.xenproject.org; Thu, 13 May 2021 13:44:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=pqEmQx+NrOcrClzPW4Ek0c+CCHvfMvHSYKciHz7VAkA=; b=sI6Y4OQ75aQU+7Kvb3wVN6AsM1
	pMZ/BH8EMaTuqsyu6mDhjfDxS67MEWNp0cl6FXsx8MOqmIExkfYVFYhxVBNoFMRRkZN2iq56866fu
	uRvz8rqH1E2zhQiPtS+nY2eOVT6L/QwbJLJN6PPWc6e9G+8gLAtHVpZGOcCubdaz7vGo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] arm/domain: Get rid of READ/WRITE_SYSREG32
Message-Id: <E1lhBdM-0005hl-Pl@xenbits.xenproject.org>
Date: Thu, 13 May 2021 13:44:12 +0000

commit 3fd8336bc599788e5a52a7e63e833b6f03d79fd5
Author:     Michal Orzel <michal.orzel@arm.com>
AuthorDate: Wed May 5 09:43:00 2021 +0200
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Mon May 10 18:16:34 2021 +0100

    arm/domain: Get rid of READ/WRITE_SYSREG32
    
    AArch64 registers are 64bit whereas AArch32 registers
    are 32bit or 64bit. MSR/MRS are expecting 64bit values thus
    we should get rid of helpers READ/WRITE_SYSREG32
    in favour of using READ/WRITE_SYSREG.
    We should also use register_t type when reading sysregs
    which can correspond to uint64_t or uint32_t.
    Even though many AArch64 registers have upper 32bit reserved
    it does not mean that they can't be widen in the future.
    
    Modify type of register cntkctl to register_t.
    
    Thumbee registers are only usable by a 32-bit domain and therefore
    we can just store the bottom 32-bit (IOW there is no type change).
    In fact, this could technically be restricted to Armv7 HW (the
    support was dropped retrospectively in Armv8) but leave it as-is
    for now.
    
    Signed-off-by: Michal Orzel <michal.orzel@arm.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/domain.c        | 18 +++++++++---------
 xen/include/asm-arm/domain.h |  2 +-
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c
index bdd3d3e5b5..621f518b83 100644
--- a/xen/arch/arm/domain.c
+++ b/xen/arch/arm/domain.c
@@ -113,13 +113,13 @@ static void ctxt_switch_from(struct vcpu *p)
     p->arch.tpidr_el1 = READ_SYSREG(TPIDR_EL1);
 
     /* Arch timer */
-    p->arch.cntkctl = READ_SYSREG32(CNTKCTL_EL1);
+    p->arch.cntkctl = READ_SYSREG(CNTKCTL_EL1);
     virt_timer_save(p);
 
     if ( is_32bit_domain(p->domain) && cpu_has_thumbee )
     {
-        p->arch.teecr = READ_SYSREG32(TEECR32_EL1);
-        p->arch.teehbr = READ_SYSREG32(TEEHBR32_EL1);
+        p->arch.teecr = READ_SYSREG(TEECR32_EL1);
+        p->arch.teehbr = READ_SYSREG(TEEHBR32_EL1);
     }
 
 #ifdef CONFIG_ARM_32
@@ -175,7 +175,7 @@ static void ctxt_switch_from(struct vcpu *p)
 
 static void ctxt_switch_to(struct vcpu *n)
 {
-    uint32_t vpidr;
+    register_t vpidr;
 
     /* When the idle VCPU is running, Xen will always stay in hypervisor
      * mode. Therefore we don't need to restore the context of an idle VCPU.
@@ -183,8 +183,8 @@ static void ctxt_switch_to(struct vcpu *n)
     if ( is_idle_vcpu(n) )
         return;
 
-    vpidr = READ_SYSREG32(MIDR_EL1);
-    WRITE_SYSREG32(vpidr, VPIDR_EL2);
+    vpidr = READ_SYSREG(MIDR_EL1);
+    WRITE_SYSREG(vpidr, VPIDR_EL2);
     WRITE_SYSREG(n->arch.vmpidr, VMPIDR_EL2);
 
     /* VGIC */
@@ -257,8 +257,8 @@ static void ctxt_switch_to(struct vcpu *n)
 
     if ( is_32bit_domain(n->domain) && cpu_has_thumbee )
     {
-        WRITE_SYSREG32(n->arch.teecr, TEECR32_EL1);
-        WRITE_SYSREG32(n->arch.teehbr, TEEHBR32_EL1);
+        WRITE_SYSREG(n->arch.teecr, TEECR32_EL1);
+        WRITE_SYSREG(n->arch.teehbr, TEEHBR32_EL1);
     }
 
 #ifdef CONFIG_ARM_32
@@ -274,7 +274,7 @@ static void ctxt_switch_to(struct vcpu *n)
 
     /* This is could trigger an hardware interrupt from the virtual
      * timer. The interrupt needs to be injected into the guest. */
-    WRITE_SYSREG32(n->arch.cntkctl, CNTKCTL_EL1);
+    WRITE_SYSREG(n->arch.cntkctl, CNTKCTL_EL1);
     virt_timer_restore(n);
 }
 
diff --git a/xen/include/asm-arm/domain.h b/xen/include/asm-arm/domain.h
index 0a74df9931..c6b59ee755 100644
--- a/xen/include/asm-arm/domain.h
+++ b/xen/include/asm-arm/domain.h
@@ -190,7 +190,7 @@ struct arch_vcpu
     struct vgic_cpu vgic;
 
     /* Timer registers  */
-    uint32_t cntkctl;
+    register_t cntkctl;
 
     struct vtimer phys_timer;
     struct vtimer virt_timer;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu May 13 13:44:23 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 13 May 2021 13:44:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.126970.238581 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lhBdX-0003AI-NZ; Thu, 13 May 2021 13:44:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 126970.238581; Thu, 13 May 2021 13:44:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lhBdX-0003AA-KJ; Thu, 13 May 2021 13:44:23 +0000
Received: by outflank-mailman (input) for mailman id 126970;
 Thu, 13 May 2021 13:44:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lhBdW-0003A0-VG
 for xen-changelog@lists.xenproject.org; Thu, 13 May 2021 13:44:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lhBdW-00034M-UX
 for xen-changelog@lists.xenproject.org; Thu, 13 May 2021 13:44:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lhBdW-0005j1-TC
 for xen-changelog@lists.xenproject.org; Thu, 13 May 2021 13:44:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=frxGpiyR9qqTPGLcUDSI4Ha4AvnkFTM0w0LdDl4UjQY=; b=uTAKtIJRqPe4lgWHrod9+Q2iD0
	6NHaubOyLOQ/jzVwcKbIzv3BaLcAbTxDv0vaYCdUXFwxBAhShlprREq1i9vQoQaMl9OYwWRAdqn0w
	NRCXv/MK/FHEs2L5vV3xxmM9SVIzFzGN8oUXAebzU1ixLiDF6LbNMKxii1CF2bOnULeM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] arm: Modify type of actlr to register_t
Message-Id: <E1lhBdW-0005j1-TC@xenbits.xenproject.org>
Date: Thu, 13 May 2021 13:44:22 +0000

commit b80470c84553808fef3a6803000ceee8a100e63c
Author:     Michal Orzel <michal.orzel@arm.com>
AuthorDate: Wed May 5 09:43:01 2021 +0200
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Mon May 10 18:16:34 2021 +0100

    arm: Modify type of actlr to register_t
    
    AArch64 registers are 64bit whereas AArch32 registers
    are 32bit or 64bit. MSR/MRS are expecting 64bit values thus
    we should get rid of helpers READ/WRITE_SYSREG32
    in favour of using READ/WRITE_SYSREG.
    We should also use register_t type when reading sysregs
    which can correspond to uint64_t or uint32_t.
    Even though many AArch64 registers have upper 32bit reserved
    it does not mean that they can't be widen in the future.
    
    ACTLR_EL1 system register bits are implementation defined
    which means it is possibly a latent bug on current HW as the CPU
    implementer may already have decided to use the top 32bit.
    
    Signed-off-by: Michal Orzel <michal.orzel@arm.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/domain.c        | 2 +-
 xen/include/asm-arm/domain.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c
index 621f518b83..c021a03c61 100644
--- a/xen/arch/arm/domain.c
+++ b/xen/arch/arm/domain.c
@@ -330,7 +330,7 @@ static void schedule_tail(struct vcpu *prev)
 
 static void continue_new_vcpu(struct vcpu *prev)
 {
-    current->arch.actlr = READ_SYSREG32(ACTLR_EL1);
+    current->arch.actlr = READ_SYSREG(ACTLR_EL1);
     processor_vcpu_initialise(current);
 
     schedule_tail(prev);
diff --git a/xen/include/asm-arm/domain.h b/xen/include/asm-arm/domain.h
index c6b59ee755..2d4f38c669 100644
--- a/xen/include/asm-arm/domain.h
+++ b/xen/include/asm-arm/domain.h
@@ -156,7 +156,7 @@ struct arch_vcpu
 
     /* Control Registers */
     register_t sctlr;
-    uint32_t actlr;
+    register_t actlr;
     uint32_t cpacr;
 
     uint32_t contextidr;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu May 13 13:44:33 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 13 May 2021 13:44:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.126971.238585 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lhBdh-0003Dr-PV; Thu, 13 May 2021 13:44:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 126971.238585; Thu, 13 May 2021 13:44:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lhBdh-0003Dj-Lz; Thu, 13 May 2021 13:44:33 +0000
Received: by outflank-mailman (input) for mailman id 126971;
 Thu, 13 May 2021 13:44:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lhBdh-0003Dc-1x
 for xen-changelog@lists.xenproject.org; Thu, 13 May 2021 13:44:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lhBdh-00034a-1J
 for xen-changelog@lists.xenproject.org; Thu, 13 May 2021 13:44:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lhBdh-0005js-0P
 for xen-changelog@lists.xenproject.org; Thu, 13 May 2021 13:44:33 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=oy2j+HV1QCJtQztjYoptDQrgMacPVG/EFn6G636jzXc=; b=iZi+4hBZ92tOFams4bZAFnBVDE
	J4nMavlcqB3ANfFRnpKDl0NUScQiFVjXJeWVFC/+c66DUD7hJcG+pE3tXDs/4hw/Qfkf074u6Dqhw
	PPFHEAsGHbB1cMvSHgbyERf9EdZgGlzTdQ+m1BRKPAlJ+2SNnjwDpfxJkqeelsnOMad0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] arm/gic: Remove member hcr of structure gic_v3
Message-Id: <E1lhBdh-0005js-0P@xenbits.xenproject.org>
Date: Thu, 13 May 2021 13:44:33 +0000

commit d55afb1acaffc6047af3cabc3ef4442f313bee2c
Author:     Michal Orzel <michal.orzel@arm.com>
AuthorDate: Wed May 5 09:43:02 2021 +0200
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Mon May 10 18:16:34 2021 +0100

    arm/gic: Remove member hcr of structure gic_v3
    
    ... as it is never used even in the patch introducing it.
    
    Signed-off-by: Michal Orzel <michal.orzel@arm.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/include/asm-arm/gic.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/include/asm-arm/gic.h b/xen/include/asm-arm/gic.h
index ad0f7452d0..5069ab4aac 100644
--- a/xen/include/asm-arm/gic.h
+++ b/xen/include/asm-arm/gic.h
@@ -171,7 +171,7 @@
  * GICv3 registers that needs to be saved/restored
  */
 struct gic_v3 {
-    uint32_t hcr, vmcr, sre_el1;
+    uint32_t vmcr, sre_el1;
     uint32_t apr0[4];
     uint32_t apr1[4];
     uint64_t lr[16];
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu May 13 13:44:43 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 13 May 2021 13:44:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.126972.238588 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lhBdr-0003Gm-Qj; Thu, 13 May 2021 13:44:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 126972.238588; Thu, 13 May 2021 13:44:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lhBdr-0003Gf-Nr; Thu, 13 May 2021 13:44:43 +0000
Received: by outflank-mailman (input) for mailman id 126972;
 Thu, 13 May 2021 13:44:43 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lhBdr-0003GV-57
 for xen-changelog@lists.xenproject.org; Thu, 13 May 2021 13:44:43 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lhBdr-00034l-4M
 for xen-changelog@lists.xenproject.org; Thu, 13 May 2021 13:44:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lhBdr-0005kd-3W
 for xen-changelog@lists.xenproject.org; Thu, 13 May 2021 13:44:43 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=hcIT12Xxyg4yyofdD2UmIMThel9ZbtZRp87TnIr0+iY=; b=3Y4WVmN2zY74Kg5ojWJqP2YpMt
	qJS5AGalqPX9mHY26y2AJbzs5Ar9EC0KQAgQyNvGKDuKbGZlUjGqIfuduzehd1wKoT0EfjkHn+wQD
	z77YlwwZMU+t2M34nVxuV8GiqxF8qnB1UbAPtkBAdRarN0kzjb3Okc40rjBO6p6zxTww=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] arm/gic: Get rid of READ/WRITE_SYSREG32
Message-Id: <E1lhBdr-0005kd-3W@xenbits.xenproject.org>
Date: Thu, 13 May 2021 13:44:43 +0000

commit 78e67c99eb3f90c22c8c6ee282ec3a43d2ddccb5
Author:     Michal Orzel <michal.orzel@arm.com>
AuthorDate: Wed May 5 09:43:03 2021 +0200
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Mon May 10 18:16:34 2021 +0100

    arm/gic: Get rid of READ/WRITE_SYSREG32
    
    AArch64 registers are 64bit whereas AArch32 registers
    are 32bit or 64bit. MSR/MRS are expecting 64bit values thus
    we should get rid of helpers READ/WRITE_SYSREG32
    in favour of using READ/WRITE_SYSREG.
    We should also use register_t type when reading sysregs
    which can correspond to uint64_t or uint32_t.
    Even though many AArch64 registers have upper 32bit reserved
    it does not mean that they can't be widen in the future.
    
    Modify types of following members of struct gic_v3 to register_t:
    -vmcr
    -sre_el1
    -apr0
    -apr1
    
    Add new macro GICC_IAR_INTID_MASK containing the mask
    for INTID field of ICC_IAR0/1_EL1 register as only the first 23-bits
    of IAR contains the interrupt number. The rest are RES0.
    Therefore, take the opportunity to mask the bits [23:31] as
    they should be used for an IRQ number (we don't know how the top bits
    will be used).
    
    Signed-off-by: Michal Orzel <michal.orzel@arm.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/gic-v3-lpi.c         |  2 +-
 xen/arch/arm/gic-v3.c             | 98 +++++++++++++++++++++------------------
 xen/include/asm-arm/gic.h         |  6 +--
 xen/include/asm-arm/gic_v3_defs.h |  2 +
 4 files changed, 58 insertions(+), 50 deletions(-)

diff --git a/xen/arch/arm/gic-v3-lpi.c b/xen/arch/arm/gic-v3-lpi.c
index 869bc97fa1..e1594dd20e 100644
--- a/xen/arch/arm/gic-v3-lpi.c
+++ b/xen/arch/arm/gic-v3-lpi.c
@@ -178,7 +178,7 @@ void gicv3_do_LPI(unsigned int lpi)
     irq_enter();
 
     /* EOI the LPI already. */
-    WRITE_SYSREG32(lpi, ICC_EOIR1_EL1);
+    WRITE_SYSREG(lpi, ICC_EOIR1_EL1);
 
     /* Find out if a guest mapped something to this physical LPI. */
     hlpip = gic_get_host_lpi(lpi);
diff --git a/xen/arch/arm/gic-v3.c b/xen/arch/arm/gic-v3.c
index ac28013c19..b86f040589 100644
--- a/xen/arch/arm/gic-v3.c
+++ b/xen/arch/arm/gic-v3.c
@@ -246,12 +246,12 @@ static void gicv3_ich_write_lr(int lr, uint64_t val)
  */
 static void gicv3_enable_sre(void)
 {
-    uint32_t val;
+    register_t val;
 
-    val = READ_SYSREG32(ICC_SRE_EL2);
+    val = READ_SYSREG(ICC_SRE_EL2);
     val |= GICC_SRE_EL2_SRE;
 
-    WRITE_SYSREG32(val, ICC_SRE_EL2);
+    WRITE_SYSREG(val, ICC_SRE_EL2);
     isb();
 }
 
@@ -315,16 +315,16 @@ static void restore_aprn_regs(const union gic_state_data *d)
     switch ( gicv3.nr_priorities )
     {
     case 7:
-        WRITE_SYSREG32(d->v3.apr0[2], ICH_AP0R2_EL2);
-        WRITE_SYSREG32(d->v3.apr1[2], ICH_AP1R2_EL2);
+        WRITE_SYSREG(d->v3.apr0[2], ICH_AP0R2_EL2);
+        WRITE_SYSREG(d->v3.apr1[2], ICH_AP1R2_EL2);
         /* Fall through */
     case 6:
-        WRITE_SYSREG32(d->v3.apr0[1], ICH_AP0R1_EL2);
-        WRITE_SYSREG32(d->v3.apr1[1], ICH_AP1R1_EL2);
+        WRITE_SYSREG(d->v3.apr0[1], ICH_AP0R1_EL2);
+        WRITE_SYSREG(d->v3.apr1[1], ICH_AP1R1_EL2);
         /* Fall through */
     case 5:
-        WRITE_SYSREG32(d->v3.apr0[0], ICH_AP0R0_EL2);
-        WRITE_SYSREG32(d->v3.apr1[0], ICH_AP1R0_EL2);
+        WRITE_SYSREG(d->v3.apr0[0], ICH_AP0R0_EL2);
+        WRITE_SYSREG(d->v3.apr1[0], ICH_AP1R0_EL2);
         break;
     default:
         BUG();
@@ -338,16 +338,16 @@ static void save_aprn_regs(union gic_state_data *d)
     switch ( gicv3.nr_priorities )
     {
     case 7:
-        d->v3.apr0[2] = READ_SYSREG32(ICH_AP0R2_EL2);
-        d->v3.apr1[2] = READ_SYSREG32(ICH_AP1R2_EL2);
+        d->v3.apr0[2] = READ_SYSREG(ICH_AP0R2_EL2);
+        d->v3.apr1[2] = READ_SYSREG(ICH_AP1R2_EL2);
         /* Fall through */
     case 6:
-        d->v3.apr0[1] = READ_SYSREG32(ICH_AP0R1_EL2);
-        d->v3.apr1[1] = READ_SYSREG32(ICH_AP1R1_EL2);
+        d->v3.apr0[1] = READ_SYSREG(ICH_AP0R1_EL2);
+        d->v3.apr1[1] = READ_SYSREG(ICH_AP1R1_EL2);
         /* Fall through */
     case 5:
-        d->v3.apr0[0] = READ_SYSREG32(ICH_AP0R0_EL2);
-        d->v3.apr1[0] = READ_SYSREG32(ICH_AP1R0_EL2);
+        d->v3.apr0[0] = READ_SYSREG(ICH_AP0R0_EL2);
+        d->v3.apr1[0] = READ_SYSREG(ICH_AP1R0_EL2);
         break;
     default:
         BUG();
@@ -371,15 +371,15 @@ static void gicv3_save_state(struct vcpu *v)
     dsb(sy);
     gicv3_save_lrs(v);
     save_aprn_regs(&v->arch.gic);
-    v->arch.gic.v3.vmcr = READ_SYSREG32(ICH_VMCR_EL2);
-    v->arch.gic.v3.sre_el1 = READ_SYSREG32(ICC_SRE_EL1);
+    v->arch.gic.v3.vmcr = READ_SYSREG(ICH_VMCR_EL2);
+    v->arch.gic.v3.sre_el1 = READ_SYSREG(ICC_SRE_EL1);
 }
 
 static void gicv3_restore_state(const struct vcpu *v)
 {
-    uint32_t val;
+    register_t val;
 
-    val = READ_SYSREG32(ICC_SRE_EL2);
+    val = READ_SYSREG(ICC_SRE_EL2);
     /*
      * Don't give access to system registers when the guest is using
      * GICv2
@@ -388,7 +388,7 @@ static void gicv3_restore_state(const struct vcpu *v)
         val &= ~GICC_SRE_EL2_ENEL1;
     else
         val |= GICC_SRE_EL2_ENEL1;
-    WRITE_SYSREG32(val, ICC_SRE_EL2);
+    WRITE_SYSREG(val, ICC_SRE_EL2);
 
     /*
      * VFIQEn is RES1 if ICC_SRE_EL1.SRE is 1. This causes a Group0
@@ -398,9 +398,9 @@ static void gicv3_restore_state(const struct vcpu *v)
      * want before starting to mess with the rest of the GIC, and
      * VMCR_EL1 in particular.
      */
-    WRITE_SYSREG32(v->arch.gic.v3.sre_el1, ICC_SRE_EL1);
+    WRITE_SYSREG(v->arch.gic.v3.sre_el1, ICC_SRE_EL1);
     isb();
-    WRITE_SYSREG32(v->arch.gic.v3.vmcr, ICH_VMCR_EL2);
+    WRITE_SYSREG(v->arch.gic.v3.vmcr, ICH_VMCR_EL2);
     restore_aprn_regs(&v->arch.gic);
     gicv3_restore_lrs(v);
 
@@ -468,24 +468,25 @@ static void gicv3_mask_irq(struct irq_desc *irqd)
 static void gicv3_eoi_irq(struct irq_desc *irqd)
 {
     /* Lower the priority */
-    WRITE_SYSREG32(irqd->irq, ICC_EOIR1_EL1);
+    WRITE_SYSREG(irqd->irq, ICC_EOIR1_EL1);
     isb();
 }
 
 static void gicv3_dir_irq(struct irq_desc *irqd)
 {
     /* Deactivate */
-    WRITE_SYSREG32(irqd->irq, ICC_DIR_EL1);
+    WRITE_SYSREG(irqd->irq, ICC_DIR_EL1);
     isb();
 }
 
 static unsigned int gicv3_read_irq(void)
 {
-    unsigned int irq = READ_SYSREG32(ICC_IAR1_EL1);
+    register_t irq = READ_SYSREG(ICC_IAR1_EL1);
 
     dsb(sy);
 
-    return irq;
+    /* IRQs are encoded using 23bit. */
+    return (irq & GICC_IAR_INTID_MASK);
 }
 
 /*
@@ -857,16 +858,16 @@ static int gicv3_cpu_init(void)
     gicv3_enable_sre();
 
     /* No priority grouping */
-    WRITE_SYSREG32(0, ICC_BPR1_EL1);
+    WRITE_SYSREG(0, ICC_BPR1_EL1);
 
     /* Set priority mask register */
-    WRITE_SYSREG32(DEFAULT_PMR_VALUE, ICC_PMR_EL1);
+    WRITE_SYSREG(DEFAULT_PMR_VALUE, ICC_PMR_EL1);
 
     /* EOI drops priority, DIR deactivates the interrupt (mode 1) */
-    WRITE_SYSREG32(GICC_CTLR_EL1_EOImode_drop, ICC_CTLR_EL1);
+    WRITE_SYSREG(GICC_CTLR_EL1_EOImode_drop, ICC_CTLR_EL1);
 
     /* Enable Group1 interrupts */
-    WRITE_SYSREG32(1, ICC_IGRPEN1_EL1);
+    WRITE_SYSREG(1, ICC_IGRPEN1_EL1);
 
     /* Sync at once at the end of cpu interface configuration */
     isb();
@@ -876,15 +877,15 @@ static int gicv3_cpu_init(void)
 
 static void gicv3_cpu_disable(void)
 {
-    WRITE_SYSREG32(0, ICC_CTLR_EL1);
+    WRITE_SYSREG(0, ICC_CTLR_EL1);
     isb();
 }
 
 static void gicv3_hyp_init(void)
 {
-    uint32_t vtr;
+    register_t vtr;
 
-    vtr = READ_SYSREG32(ICH_VTR_EL2);
+    vtr = READ_SYSREG(ICH_VTR_EL2);
     gicv3_info.nr_lrs  = (vtr & ICH_VTR_NRLRGS) + 1;
     gicv3.nr_priorities = ((vtr >> ICH_VTR_PRIBITS_SHIFT) &
                           ICH_VTR_PRIBITS_MASK) + 1;
@@ -892,8 +893,8 @@ static void gicv3_hyp_init(void)
     if ( !((gicv3.nr_priorities > 4) && (gicv3.nr_priorities < 8)) )
         panic("GICv3: Invalid number of priority bits\n");
 
-    WRITE_SYSREG32(ICH_VMCR_EOI | ICH_VMCR_VENG1, ICH_VMCR_EL2);
-    WRITE_SYSREG32(GICH_HCR_EN, ICH_HCR_EL2);
+    WRITE_SYSREG(ICH_VMCR_EOI | ICH_VMCR_VENG1, ICH_VMCR_EL2);
+    WRITE_SYSREG(GICH_HCR_EN, ICH_HCR_EL2);
 }
 
 /* Set up the per-CPU parts of the GIC for a secondary CPU */
@@ -917,11 +918,11 @@ out:
 
 static void gicv3_hyp_disable(void)
 {
-    uint32_t hcr;
+    register_t hcr;
 
-    hcr = READ_SYSREG32(ICH_HCR_EL2);
+    hcr = READ_SYSREG(ICH_HCR_EL2);
     hcr &= ~GICH_HCR_EN;
-    WRITE_SYSREG32(hcr, ICH_HCR_EL2);
+    WRITE_SYSREG(hcr, ICH_HCR_EL2);
     isb();
 }
 
@@ -1140,39 +1141,44 @@ static void gicv3_write_lr(int lr_reg, const struct gic_lr *lr)
 
 static void gicv3_hcr_status(uint32_t flag, bool status)
 {
-    uint32_t hcr;
+    register_t hcr;
 
-    hcr = READ_SYSREG32(ICH_HCR_EL2);
+    hcr = READ_SYSREG(ICH_HCR_EL2);
     if ( status )
-        WRITE_SYSREG32(hcr | flag, ICH_HCR_EL2);
+        WRITE_SYSREG(hcr | flag, ICH_HCR_EL2);
     else
-        WRITE_SYSREG32(hcr & (~flag), ICH_HCR_EL2);
+        WRITE_SYSREG(hcr & (~flag), ICH_HCR_EL2);
     isb();
 }
 
 static unsigned int gicv3_read_vmcr_priority(void)
 {
-   return ((READ_SYSREG32(ICH_VMCR_EL2) >> ICH_VMCR_PRIORITY_SHIFT) &
+   return ((READ_SYSREG(ICH_VMCR_EL2) >> ICH_VMCR_PRIORITY_SHIFT) &
             ICH_VMCR_PRIORITY_MASK);
 }
 
 /* Only support reading GRP1 APRn registers */
 static unsigned int gicv3_read_apr(int apr_reg)
 {
+    register_t apr;
+
     switch ( apr_reg )
     {
     case 0:
         ASSERT(gicv3.nr_priorities > 4 && gicv3.nr_priorities < 8);
-        return READ_SYSREG32(ICH_AP1R0_EL2);
+        apr = READ_SYSREG(ICH_AP1R0_EL2);
     case 1:
         ASSERT(gicv3.nr_priorities > 5 && gicv3.nr_priorities < 8);
-        return READ_SYSREG32(ICH_AP1R1_EL2);
+        apr = READ_SYSREG(ICH_AP1R1_EL2);
     case 2:
         ASSERT(gicv3.nr_priorities > 6 && gicv3.nr_priorities < 8);
-        return READ_SYSREG32(ICH_AP1R2_EL2);
+        apr = READ_SYSREG(ICH_AP1R2_EL2);
     default:
         BUG();
     }
+
+    /* Number of priority levels do not exceed 32bit. */
+    return apr;
 }
 
 static bool gicv3_read_pending_state(struct irq_desc *irqd)
diff --git a/xen/include/asm-arm/gic.h b/xen/include/asm-arm/gic.h
index 5069ab4aac..c7f0c343d1 100644
--- a/xen/include/asm-arm/gic.h
+++ b/xen/include/asm-arm/gic.h
@@ -171,9 +171,9 @@
  * GICv3 registers that needs to be saved/restored
  */
 struct gic_v3 {
-    uint32_t vmcr, sre_el1;
-    uint32_t apr0[4];
-    uint32_t apr1[4];
+    register_t vmcr, sre_el1;
+    register_t apr0[4];
+    register_t apr1[4];
     uint64_t lr[16];
 };
 #endif
diff --git a/xen/include/asm-arm/gic_v3_defs.h b/xen/include/asm-arm/gic_v3_defs.h
index 5a578e7c11..34ed5f857d 100644
--- a/xen/include/asm-arm/gic_v3_defs.h
+++ b/xen/include/asm-arm/gic_v3_defs.h
@@ -45,6 +45,8 @@
 #define GICC_SRE_EL2_DIB             (1UL << 2)
 #define GICC_SRE_EL2_ENEL1           (1UL << 3)
 
+#define GICC_IAR_INTID_MASK          (0xFFFFFF)
+
 /* Additional bits in GICD_TYPER defined by GICv3 */
 #define GICD_TYPE_ID_BITS_SHIFT 19
 #define GICD_TYPE_ID_BITS(r)    ((((r) >> GICD_TYPE_ID_BITS_SHIFT) & 0x1f) + 1)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu May 13 13:44:53 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 13 May 2021 13:44:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.126973.238593 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lhBe1-0003Jv-Tp; Thu, 13 May 2021 13:44:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 126973.238593; Thu, 13 May 2021 13:44:53 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lhBe1-0003Jn-Qt; Thu, 13 May 2021 13:44:53 +0000
Received: by outflank-mailman (input) for mailman id 126973;
 Thu, 13 May 2021 13:44:53 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lhBe1-0003Ja-89
 for xen-changelog@lists.xenproject.org; Thu, 13 May 2021 13:44:53 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lhBe1-00034z-7R
 for xen-changelog@lists.xenproject.org; Thu, 13 May 2021 13:44:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lhBe1-0005lO-6f
 for xen-changelog@lists.xenproject.org; Thu, 13 May 2021 13:44:53 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=3ZhiZef5KOy58VGfMpuw7Lr+tR2WShsORCNjrY2ZZiA=; b=JynnYaoPtNJhd4wFvzYffeoWO3
	fdph1kXrN/6JJTINsqPMu+RhneVefxyd8vh7QfHr4RTqXHPTScA7hJXHhRbsQaPhSKEQpFBIQWTHB
	mdun4FbwlVGOqehLDZhvtaVAGp/A2C7/l7gsYzpodfPXcCbPxDXYXnN0DcnLW4tmJHKM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] arm/p2m: Get rid of READ/WRITE_SYSREG32
Message-Id: <E1lhBe1-0005lO-6f@xenbits.xenproject.org>
Date: Thu, 13 May 2021 13:44:53 +0000

commit 8eb7cc0465fa228064e807aad51eb7428d6d3199
Author:     Michal Orzel <michal.orzel@arm.com>
AuthorDate: Wed May 5 09:43:04 2021 +0200
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Mon May 10 18:16:34 2021 +0100

    arm/p2m: Get rid of READ/WRITE_SYSREG32
    
    AArch64 registers are 64bit whereas AArch32 registers
    are 32bit or 64bit. MSR/MRS are expecting 64bit values thus
    we should get rid of helpers READ/WRITE_SYSREG32
    in favour of using READ/WRITE_SYSREG.
    We should also use register_t type when reading sysregs
    which can correspond to uint64_t or uint32_t.
    Even though many AArch64 registers have upper 32bit reserved
    it does not mean that they can't be widen in the future.
    
    Modify type of vtcr to register_t.
    
    Signed-off-by: Michal Orzel <michal.orzel@arm.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/p2m.c   | 8 ++++----
 xen/arch/arm/traps.c | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c
index ac50312620..d414c4feb9 100644
--- a/xen/arch/arm/p2m.c
+++ b/xen/arch/arm/p2m.c
@@ -1973,11 +1973,11 @@ void __init p2m_restrict_ipa_bits(unsigned int ipa_bits)
 }
 
 /* VTCR value to be configured by all CPUs. Set only once by the boot CPU */
-static uint32_t __read_mostly vtcr;
+static register_t __read_mostly vtcr;
 
 static void setup_virt_paging_one(void *data)
 {
-    WRITE_SYSREG32(vtcr, VTCR_EL2);
+    WRITE_SYSREG(vtcr, VTCR_EL2);
 
     /*
      * ARM64_WORKAROUND_AT_SPECULATE: We want to keep the TLBs free from
@@ -2000,7 +2000,7 @@ static void setup_virt_paging_one(void *data)
 void __init setup_virt_paging(void)
 {
     /* Setup Stage 2 address translation */
-    unsigned long val = VTCR_RES1|VTCR_SH0_IS|VTCR_ORGN0_WBWA|VTCR_IRGN0_WBWA;
+    register_t val = VTCR_RES1|VTCR_SH0_IS|VTCR_ORGN0_WBWA|VTCR_IRGN0_WBWA;
 
 #ifdef CONFIG_ARM_32
     if ( p2m_ipa_bits < 40 )
@@ -2089,7 +2089,7 @@ void __init setup_virt_paging(void)
            pa_range_info[pa_range].pabits,
            ( MAX_VMID == MAX_VMID_16_BIT ) ? 16 : 8);
 #endif
-    printk("P2M: %d levels with order-%d root, VTCR 0x%lx\n",
+    printk("P2M: %d levels with order-%d root, VTCR 0x%"PRIregister"\n",
            4 - P2M_ROOT_LEVEL, P2M_ROOT_ORDER, val);
 
     p2m_vmid_allocator_init();
diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
index ccc0827107..c7acdb2087 100644
--- a/xen/arch/arm/traps.c
+++ b/xen/arch/arm/traps.c
@@ -911,7 +911,7 @@ static void _show_registers(const struct cpu_user_regs *regs,
         show_registers_32(regs, ctxt, guest_mode, v);
 #endif
     }
-    printk("  VTCR_EL2: %08"PRIx32"\n", READ_SYSREG32(VTCR_EL2));
+    printk("  VTCR_EL2: %"PRIregister"\n", READ_SYSREG(VTCR_EL2));
     printk(" VTTBR_EL2: %016"PRIx64"\n", ctxt->vttbr_el2);
     printk("\n");
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu May 13 13:45:05 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 13 May 2021 13:45:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.126974.238597 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lhBeC-0003NA-Vn; Thu, 13 May 2021 13:45:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 126974.238597; Thu, 13 May 2021 13:45:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lhBeC-0003N2-SW; Thu, 13 May 2021 13:45:04 +0000
Received: by outflank-mailman (input) for mailman id 126974;
 Thu, 13 May 2021 13:45:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lhBeB-0003Mi-BS
 for xen-changelog@lists.xenproject.org; Thu, 13 May 2021 13:45:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lhBeB-00035u-Ac
 for xen-changelog@lists.xenproject.org; Thu, 13 May 2021 13:45:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lhBeB-0005mX-9o
 for xen-changelog@lists.xenproject.org; Thu, 13 May 2021 13:45:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=VIgyw8J1MGh0TiFNXUFjnBfvnGQ7z2YCH4Sm9oSYKMM=; b=rRNUr3uafCWfpDWODluAhZSDWP
	BurkkGmz6pJ7Opl6ZWMxqcYPz5VM6SPekUi9c0TPUZd308tYuRYilT9DBwtAyV4XbG7wnsMbW3dSJ
	8Z8iLGQgiJzGb7Z3gx1BxwD48KskQBW5C6FggTev7g9xlwIbVZ4INkRxVvhHP7NwNj74=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: Always access SCTLR_EL2 using READ/WRITE_SYSREG()
Message-Id: <E1lhBeB-0005mX-9o@xenbits.xenproject.org>
Date: Thu, 13 May 2021 13:45:03 +0000

commit 25e5d0c412e0d7420f2aa7fdd71cc39d8ed6c528
Author:     Michal Orzel <michal.orzel@arm.com>
AuthorDate: Wed May 5 09:43:05 2021 +0200
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Mon May 10 18:16:34 2021 +0100

    xen/arm: Always access SCTLR_EL2 using READ/WRITE_SYSREG()
    
    The Armv8 specification describes the system register as a 64-bit value
    on AArch64 and 32-bit value on AArch32 (same as ARMv7).
    
    Unfortunately, Xen is accessing the system registers using
    READ/WRITE_SYSREG32() which means the top 32-bit are clobbered.
    
    This is only a latent bug so far because Xen will not yet use the top
    32-bit.
    
    There is also no change in behavior because arch/arm/arm64/head.S will
    initialize SCTLR_EL2 to a sane value with the top 32-bit zeroed.
    
    Signed-off-by: Michal Orzel <michal.orzel@arm.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/mm.c    | 2 +-
 xen/arch/arm/traps.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c
index 59f8a3f15f..0e07335291 100644
--- a/xen/arch/arm/mm.c
+++ b/xen/arch/arm/mm.c
@@ -613,7 +613,7 @@ void __init remove_early_mappings(void)
  */
 static void xen_pt_enforce_wnx(void)
 {
-    WRITE_SYSREG32(READ_SYSREG32(SCTLR_EL2) | SCTLR_Axx_ELx_WXN, SCTLR_EL2);
+    WRITE_SYSREG(READ_SYSREG(SCTLR_EL2) | SCTLR_Axx_ELx_WXN, SCTLR_EL2);
     /*
      * The TLBs may cache SCTLR_EL2.WXN. So ensure it is synchronized
      * before flushing the TLBs.
diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
index c7acdb2087..e7384381cc 100644
--- a/xen/arch/arm/traps.c
+++ b/xen/arch/arm/traps.c
@@ -915,7 +915,7 @@ static void _show_registers(const struct cpu_user_regs *regs,
     printk(" VTTBR_EL2: %016"PRIx64"\n", ctxt->vttbr_el2);
     printk("\n");
 
-    printk(" SCTLR_EL2: %08"PRIx32"\n", READ_SYSREG32(SCTLR_EL2));
+    printk(" SCTLR_EL2: %"PRIregister"\n", READ_SYSREG(SCTLR_EL2));
     printk("   HCR_EL2: %"PRIregister"\n", READ_SYSREG(HCR_EL2));
     printk(" TTBR0_EL2: %016"PRIx64"\n", READ_SYSREG64(TTBR0_EL2));
     printk("\n");
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu May 13 13:45:15 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 13 May 2021 13:45:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.126975.238602 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lhBeN-0003QR-1Z; Thu, 13 May 2021 13:45:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 126975.238602; Thu, 13 May 2021 13:45:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lhBeM-0003QF-UI; Thu, 13 May 2021 13:45:14 +0000
Received: by outflank-mailman (input) for mailman id 126975;
 Thu, 13 May 2021 13:45:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lhBeL-0003Px-ET
 for xen-changelog@lists.xenproject.org; Thu, 13 May 2021 13:45:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lhBeL-000365-Dl
 for xen-changelog@lists.xenproject.org; Thu, 13 May 2021 13:45:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lhBeL-0005nV-Ci
 for xen-changelog@lists.xenproject.org; Thu, 13 May 2021 13:45:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=nxa3ahMDkXDJphdvqZJgAcVdZaUKG0tdHSfP6Twh3BY=; b=doBVBq+xAAIUnGeb/xIwnE3kbJ
	ZoUpvSgN3LQSze/TKEDYhYuDkITnBsJLHVMYsIJHCTKU2NieA2wz/GCV5ZOsJBsvGMmv5dS0ydMW3
	5CrMrDPS9n7kriDZU+C6hzrEY6CQaj0MoXKpSBWhIimO1FvWEFA1DPRG6cFZxlHXrwx4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] arm/page: Get rid of READ/WRITE_SYSREG32
Message-Id: <E1lhBeL-0005nV-Ci@xenbits.xenproject.org>
Date: Thu, 13 May 2021 13:45:13 +0000

commit 86faae561cd8eee819e0f42ba7a18dd180aa49d1
Author:     Michal Orzel <michal.orzel@arm.com>
AuthorDate: Wed May 5 09:43:06 2021 +0200
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Mon May 10 18:16:34 2021 +0100

    arm/page: Get rid of READ/WRITE_SYSREG32
    
    AArch64 registers are 64bit whereas AArch32 registers
    are 32bit or 64bit. MSR/MRS are expecting 64bit values thus
    we should get rid of helpers READ/WRITE_SYSREG32
    in favour of using READ/WRITE_SYSREG.
    We should also use register_t type when reading sysregs
    which can correspond to uint64_t or uint32_t.
    Even though many AArch64 registers have upper 32bit reserved
    it does not mean that they can't be widen in the future.
    
    Modify accesses to CTR_EL0 to use READ/WRITE_SYSREG.
    
    Signed-off-by: Michal Orzel <michal.orzel@arm.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
---
 xen/include/asm-arm/page.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/include/asm-arm/page.h b/xen/include/asm-arm/page.h
index 131507a517..c6f9fb0d4e 100644
--- a/xen/include/asm-arm/page.h
+++ b/xen/include/asm-arm/page.h
@@ -137,10 +137,10 @@ extern size_t dcache_line_bytes;
 
 static inline size_t read_dcache_line_bytes(void)
 {
-    uint32_t ctr;
+    register_t ctr;
 
     /* Read CTR */
-    ctr = READ_SYSREG32(CTR_EL0);
+    ctr = READ_SYSREG(CTR_EL0);
 
     /* Bits 16-19 are the log2 number of words in the cacheline. */
     return (size_t) (4 << ((ctr >> 16) & 0xf));
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu May 13 13:45:25 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 13 May 2021 13:45:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.126976.238605 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lhBeX-0003Sg-2l; Thu, 13 May 2021 13:45:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 126976.238605; Thu, 13 May 2021 13:45:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lhBeW-0003SY-Vx; Thu, 13 May 2021 13:45:24 +0000
Received: by outflank-mailman (input) for mailman id 126976;
 Thu, 13 May 2021 13:45:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lhBeV-0003SQ-Hl
 for xen-changelog@lists.xenproject.org; Thu, 13 May 2021 13:45:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lhBeV-00036G-Gz
 for xen-changelog@lists.xenproject.org; Thu, 13 May 2021 13:45:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lhBeV-0005oE-G2
 for xen-changelog@lists.xenproject.org; Thu, 13 May 2021 13:45:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=QnZTPhNig2DNAdL1rsd5KgCz2v6fyVPs7X3sFjvNI5I=; b=eOFosXpHRjtvxH9RD6VrMkPAg5
	ko1di+9YYwrdazrIWJU3rB+cMo2MAf7pWaF5zdrf6+sGuoKBxzufqEgm3S3dpdb6LdvYgZD3lG6hG
	MBeDOtWxAOnbSXMzRvV3FRA+x1vm5z66OU+/GxmIhfC3H/PshI/x+PBztAorS/p58ls8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] arm/time,vtimer: Get rid of READ/WRITE_SYSREG32
Message-Id: <E1lhBeV-0005oE-G2@xenbits.xenproject.org>
Date: Thu, 13 May 2021 13:45:23 +0000

commit 3f568354a95ee2f0c9c553efb94c734fa6848af0
Author:     Michal Orzel <michal.orzel@arm.com>
AuthorDate: Wed May 5 09:43:07 2021 +0200
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Mon May 10 18:16:34 2021 +0100

    arm/time,vtimer: Get rid of READ/WRITE_SYSREG32
    
    AArch64 registers are 64bit whereas AArch32 registers
    are 32bit or 64bit. MSR/MRS are expecting 64bit values thus
    we should get rid of helpers READ/WRITE_SYSREG32
    in favour of using READ/WRITE_SYSREG.
    We should also use register_t type when reading sysregs
    which can correspond to uint64_t or uint32_t.
    Even though many AArch64 registers have upper 32bit reserved
    it does not mean that they can't be widen in the future.
    
    Modify type of vtimer structure's member: ctl to register_t.
    
    Add macro CNTFRQ_MASK containing mask for timer clock frequency
    field of CNTFRQ_EL0 register.
    
    Modify CNTx_CTL_* macros to return unsigned long instead of
    unsigned int as ctl is now of type register_t.
    
    Signed-off-by: Michal Orzel <michal.orzel@arm.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/time.c             | 28 ++++++++++++++--------------
 xen/arch/arm/vtimer.c           | 10 +++++-----
 xen/include/asm-arm/domain.h    |  2 +-
 xen/include/asm-arm/processor.h |  5 ++++-
 4 files changed, 24 insertions(+), 21 deletions(-)

diff --git a/xen/arch/arm/time.c b/xen/arch/arm/time.c
index b0021c2c69..7dbd363537 100644
--- a/xen/arch/arm/time.c
+++ b/xen/arch/arm/time.c
@@ -145,7 +145,7 @@ void __init preinit_xen_time(void)
         preinit_acpi_xen_time();
 
     if ( !cpu_khz )
-        cpu_khz = READ_SYSREG32(CNTFRQ_EL0) / 1000;
+        cpu_khz = (READ_SYSREG(CNTFRQ_EL0) & CNTFRQ_MASK) / 1000;
 
     res = platform_init_time();
     if ( res )
@@ -205,13 +205,13 @@ int reprogram_timer(s_time_t timeout)
 
     if ( timeout == 0 )
     {
-        WRITE_SYSREG32(0, CNTHP_CTL_EL2);
+        WRITE_SYSREG(0, CNTHP_CTL_EL2);
         return 1;
     }
 
     deadline = ns_to_ticks(timeout) + boot_count;
     WRITE_SYSREG64(deadline, CNTHP_CVAL_EL2);
-    WRITE_SYSREG32(CNTx_CTL_ENABLE, CNTHP_CTL_EL2);
+    WRITE_SYSREG(CNTx_CTL_ENABLE, CNTHP_CTL_EL2);
     isb();
 
     /* No need to check for timers in the past; the Generic Timer fires
@@ -223,23 +223,23 @@ int reprogram_timer(s_time_t timeout)
 static void timer_interrupt(int irq, void *dev_id, struct cpu_user_regs *regs)
 {
     if ( irq == (timer_irq[TIMER_HYP_PPI]) &&
-         READ_SYSREG32(CNTHP_CTL_EL2) & CNTx_CTL_PENDING )
+         READ_SYSREG(CNTHP_CTL_EL2) & CNTx_CTL_PENDING )
     {
         perfc_incr(hyp_timer_irqs);
         /* Signal the generic timer code to do its work */
         raise_softirq(TIMER_SOFTIRQ);
         /* Disable the timer to avoid more interrupts */
-        WRITE_SYSREG32(0, CNTHP_CTL_EL2);
+        WRITE_SYSREG(0, CNTHP_CTL_EL2);
     }
 
     if ( irq == (timer_irq[TIMER_PHYS_NONSECURE_PPI]) &&
-         READ_SYSREG32(CNTP_CTL_EL0) & CNTx_CTL_PENDING )
+         READ_SYSREG(CNTP_CTL_EL0) & CNTx_CTL_PENDING )
     {
         perfc_incr(phys_timer_irqs);
         /* Signal the generic timer code to do its work */
         raise_softirq(TIMER_SOFTIRQ);
         /* Disable the timer to avoid more interrupts */
-        WRITE_SYSREG32(0, CNTP_CTL_EL0);
+        WRITE_SYSREG(0, CNTP_CTL_EL0);
     }
 }
 
@@ -260,8 +260,8 @@ static void vtimer_interrupt(int irq, void *dev_id, struct cpu_user_regs *regs)
 
     perfc_incr(virt_timer_irqs);
 
-    current->arch.virt_timer.ctl = READ_SYSREG32(CNTV_CTL_EL0);
-    WRITE_SYSREG32(current->arch.virt_timer.ctl | CNTx_CTL_MASK, CNTV_CTL_EL0);
+    current->arch.virt_timer.ctl = READ_SYSREG(CNTV_CTL_EL0);
+    WRITE_SYSREG(current->arch.virt_timer.ctl | CNTx_CTL_MASK, CNTV_CTL_EL0);
     vgic_inject_irq(current->domain, current, current->arch.virt_timer.irq, true);
 }
 
@@ -297,9 +297,9 @@ void init_timer_interrupt(void)
     /* Sensible defaults */
     WRITE_SYSREG64(0, CNTVOFF_EL2);     /* No VM-specific offset */
     /* Do not let the VMs program the physical timer, only read the physical counter */
-    WRITE_SYSREG32(CNTHCTL_EL2_EL1PCTEN, CNTHCTL_EL2);
-    WRITE_SYSREG32(0, CNTP_CTL_EL0);    /* Physical timer disabled */
-    WRITE_SYSREG32(0, CNTHP_CTL_EL2);   /* Hypervisor's timer disabled */
+    WRITE_SYSREG(CNTHCTL_EL2_EL1PCTEN, CNTHCTL_EL2);
+    WRITE_SYSREG(0, CNTP_CTL_EL0);    /* Physical timer disabled */
+    WRITE_SYSREG(0, CNTHP_CTL_EL2);   /* Hypervisor's timer disabled */
     isb();
 
     request_irq(timer_irq[TIMER_HYP_PPI], 0, timer_interrupt,
@@ -320,8 +320,8 @@ void init_timer_interrupt(void)
  */
 static void deinit_timer_interrupt(void)
 {
-    WRITE_SYSREG32(0, CNTP_CTL_EL0);    /* Disable physical timer */
-    WRITE_SYSREG32(0, CNTHP_CTL_EL2);   /* Disable hypervisor's timer */
+    WRITE_SYSREG(0, CNTP_CTL_EL0);    /* Disable physical timer */
+    WRITE_SYSREG(0, CNTHP_CTL_EL2);   /* Disable hypervisor's timer */
     isb();
 
     release_irq(timer_irq[TIMER_HYP_PPI], NULL);
diff --git a/xen/arch/arm/vtimer.c b/xen/arch/arm/vtimer.c
index c2b27915c6..167fc6127a 100644
--- a/xen/arch/arm/vtimer.c
+++ b/xen/arch/arm/vtimer.c
@@ -138,8 +138,8 @@ void virt_timer_save(struct vcpu *v)
 {
     ASSERT(!is_idle_vcpu(v));
 
-    v->arch.virt_timer.ctl = READ_SYSREG32(CNTV_CTL_EL0);
-    WRITE_SYSREG32(v->arch.virt_timer.ctl & ~CNTx_CTL_ENABLE, CNTV_CTL_EL0);
+    v->arch.virt_timer.ctl = READ_SYSREG(CNTV_CTL_EL0);
+    WRITE_SYSREG(v->arch.virt_timer.ctl & ~CNTx_CTL_ENABLE, CNTV_CTL_EL0);
     v->arch.virt_timer.cval = READ_SYSREG64(CNTV_CVAL_EL0);
     if ( (v->arch.virt_timer.ctl & CNTx_CTL_ENABLE) &&
          !(v->arch.virt_timer.ctl & CNTx_CTL_MASK))
@@ -159,7 +159,7 @@ void virt_timer_restore(struct vcpu *v)
 
     WRITE_SYSREG64(v->domain->arch.virt_timer_base.offset, CNTVOFF_EL2);
     WRITE_SYSREG64(v->arch.virt_timer.cval, CNTV_CVAL_EL0);
-    WRITE_SYSREG32(v->arch.virt_timer.ctl, CNTV_CTL_EL0);
+    WRITE_SYSREG(v->arch.virt_timer.ctl, CNTV_CTL_EL0);
 }
 
 static bool vtimer_cntp_ctl(struct cpu_user_regs *regs, uint32_t *r, bool read)
@@ -347,7 +347,7 @@ bool vtimer_emulate(struct cpu_user_regs *regs, union hsr hsr)
 }
 
 static void vtimer_update_irq(struct vcpu *v, struct vtimer *vtimer,
-                              uint32_t vtimer_ctl)
+                              register_t vtimer_ctl)
 {
     bool level;
 
@@ -389,7 +389,7 @@ void vtimer_update_irqs(struct vcpu *v)
      * but this requires reworking the arch timer to implement this.
      */
     vtimer_update_irq(v, &v->arch.virt_timer,
-                      READ_SYSREG32(CNTV_CTL_EL0) & ~CNTx_CTL_MASK);
+                      READ_SYSREG(CNTV_CTL_EL0) & ~CNTx_CTL_MASK);
 
     /* For the physical timer we rely on our emulated state. */
     vtimer_update_irq(v, &v->arch.phys_timer, v->arch.phys_timer.ctl);
diff --git a/xen/include/asm-arm/domain.h b/xen/include/asm-arm/domain.h
index 2d4f38c669..c9277b5c6d 100644
--- a/xen/include/asm-arm/domain.h
+++ b/xen/include/asm-arm/domain.h
@@ -36,7 +36,7 @@ struct vtimer {
     struct vcpu *v;
     int irq;
     struct timer timer;
-    uint32_t ctl;
+    register_t ctl;
     uint64_t cval;
 };
 
diff --git a/xen/include/asm-arm/processor.h b/xen/include/asm-arm/processor.h
index 5c1768cdec..2577e9a244 100644
--- a/xen/include/asm-arm/processor.h
+++ b/xen/include/asm-arm/processor.h
@@ -485,9 +485,12 @@ extern register_t __cpu_logical_map[];
 
 /* Timer control registers */
 #define CNTx_CTL_ENABLE   (1u<<0)  /* Enable timer */
-#define CNTx_CTL_MASK     (1u<<1)  /* Mask IRQ */
+#define CNTx_CTL_MASK     (1ul<<1)  /* Mask IRQ */
 #define CNTx_CTL_PENDING  (1u<<2)  /* IRQ pending */
 
+/* Timer frequency mask */
+#define CNTFRQ_MASK       GENMASK(31, 0)
+
 /* Exception Vector offsets */
 /* ... ARM32 */
 #define VECTOR32_RST  0
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu May 13 13:45:35 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 13 May 2021 13:45:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.126977.238608 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lhBeh-0003Vv-4p; Thu, 13 May 2021 13:45:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 126977.238608; Thu, 13 May 2021 13:45:35 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lhBeh-0003Vl-1I; Thu, 13 May 2021 13:45:35 +0000
Received: by outflank-mailman (input) for mailman id 126977;
 Thu, 13 May 2021 13:45:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lhBef-0003VV-MZ
 for xen-changelog@lists.xenproject.org; Thu, 13 May 2021 13:45:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lhBef-00036O-Lm
 for xen-changelog@lists.xenproject.org; Thu, 13 May 2021 13:45:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lhBef-0005p7-JK
 for xen-changelog@lists.xenproject.org; Thu, 13 May 2021 13:45:33 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=QDLIt0/MM0ByL61eJgbHyOl5ovEKNu1PRjJNO6nNQSY=; b=sS2EXs0jb9/j0L4kYF+cu4eGUs
	QO4u1rbM5AKDN9TkOrWXZ0g3JHMxfC2yH6adk5dsf5wgH/NltFiXa7sOW6K4Ue1g+ybjS0jVidlN0
	ZbuXRstyeoCmRgqAv7Yu7qDhOMv7VL82lLn0fUEguG6lxcbz/BjB6TuTcqizU95m0WNY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/xenstored: Prevent a buffer overflow in dump_state_node_perms()
Message-Id: <E1lhBef-0005p7-JK@xenbits.xenproject.org>
Date: Thu, 13 May 2021 13:45:33 +0000

commit 7e71b1e0affa83c0976c832f254276eeb6e6575c
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Thu May 6 17:12:23 2021 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Mon May 10 18:25:52 2021 +0100

    tools/xenstored: Prevent a buffer overflow in dump_state_node_perms()
    
    ASAN reported one issue when Live Updating Xenstored:
    
    =================================================================
    ==873==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7ffc194f53e0 at pc 0x555c6b323292 bp 0x7ffc194f5340 sp 0x7ffc194f5338
    WRITE of size 1 at 0x7ffc194f53e0 thread T0
        #0 0x555c6b323291 in dump_state_node_perms xen/tools/xenstore/xenstored_core.c:2468
        #1 0x555c6b32746e in dump_state_special_node xen/tools/xenstore/xenstored_domain.c:1257
        #2 0x555c6b32a702 in dump_state_special_nodes xen/tools/xenstore/xenstored_domain.c:1273
        #3 0x555c6b32ddb3 in lu_dump_state xen/tools/xenstore/xenstored_control.c:521
        #4 0x555c6b32e380 in do_lu_start xen/tools/xenstore/xenstored_control.c:660
        #5 0x555c6b31b461 in call_delayed xen/tools/xenstore/xenstored_core.c:278
        #6 0x555c6b32275e in main xen/tools/xenstore/xenstored_core.c:2357
        #7 0x7f95eecf3d09 in __libc_start_main ../csu/libc-start.c:308
        #8 0x555c6b3197e9 in _start (/usr/local/sbin/xenstored+0xc7e9)
    
    Address 0x7ffc194f53e0 is located in stack of thread T0 at offset 80 in frame
        #0 0x555c6b32713e in dump_state_special_node xen/tools/xenstore/xenstored_domain.c:1232
    
      This frame has 2 object(s):
        [32, 40) 'head' (line 1233)
        [64, 80) 'sn' (line 1234) <== Memory access at offset 80 overflows this variable
    
    This is happening because the callers are passing a pointer to a variable
    allocated on the stack. However, the field perms is a dynamic array, so
    Xenstored will end up to read outside of the variable.
    
    Rework the code so the permissions are written one by one in the fd.
    
    Fixes: ed6eebf17d2c ("tools/xenstore: dump the xenstore state for live update")
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
---
 tools/xenstore/xenstored_core.c   | 26 ++++++++++++++------------
 tools/xenstore/xenstored_core.h   |  3 +--
 tools/xenstore/xenstored_domain.c |  2 +-
 3 files changed, 16 insertions(+), 15 deletions(-)

diff --git a/tools/xenstore/xenstored_core.c b/tools/xenstore/xenstored_core.c
index c638e46221..02ae390e25 100644
--- a/tools/xenstore/xenstored_core.c
+++ b/tools/xenstore/xenstored_core.c
@@ -2447,34 +2447,36 @@ const char *dump_state_buffered_data(FILE *fp, const struct connection *c,
 	return NULL;
 }
 
-const char *dump_state_node_perms(FILE *fp, struct xs_state_node *sn,
-				  const struct xs_permissions *perms,
+const char *dump_state_node_perms(FILE *fp, const struct xs_permissions *perms,
 				  unsigned int n_perms)
 {
 	unsigned int p;
 
 	for (p = 0; p < n_perms; p++) {
+		struct xs_state_node_perm sp;
+
 		switch ((int)perms[p].perms & ~XS_PERM_IGNORE) {
 		case XS_PERM_READ:
-			sn->perms[p].access = XS_STATE_NODE_PERM_READ;
+			sp.access = XS_STATE_NODE_PERM_READ;
 			break;
 		case XS_PERM_WRITE:
-			sn->perms[p].access = XS_STATE_NODE_PERM_WRITE;
+			sp.access = XS_STATE_NODE_PERM_WRITE;
 			break;
 		case XS_PERM_READ | XS_PERM_WRITE:
-			sn->perms[p].access = XS_STATE_NODE_PERM_BOTH;
+			sp.access = XS_STATE_NODE_PERM_BOTH;
 			break;
 		default:
-			sn->perms[p].access = XS_STATE_NODE_PERM_NONE;
+			sp.access = XS_STATE_NODE_PERM_NONE;
 			break;
 		}
-		sn->perms[p].flags = (perms[p].perms & XS_PERM_IGNORE)
+		sp.flags = (perms[p].perms & XS_PERM_IGNORE)
 				     ? XS_STATE_NODE_PERM_IGNORE : 0;
-		sn->perms[p].domid = perms[p].id;
-	}
+		sp.domid = perms[p].id;
 
-	if (fwrite(sn->perms, sizeof(*sn->perms), n_perms, fp) != n_perms)
-		return "Dump node permissions error";
+		if (fwrite(&sp, sizeof(sp), 1, fp) != 1)
+			return "Dump node permission error";
+
+	}
 
 	return NULL;
 }
@@ -2519,7 +2521,7 @@ static const char *dump_state_node_tree(FILE *fp, char *path)
 	if (fwrite(&sn, sizeof(sn), 1, fp) != 1)
 		return "Dump node state error";
 
-	ret = dump_state_node_perms(fp, &sn, hdr->perms, hdr->num_perms);
+	ret = dump_state_node_perms(fp, hdr->perms, hdr->num_perms);
 	if (ret)
 		return ret;
 
diff --git a/tools/xenstore/xenstored_core.h b/tools/xenstore/xenstored_core.h
index 1cdbc3dcb5..b50ea3f57d 100644
--- a/tools/xenstore/xenstored_core.h
+++ b/tools/xenstore/xenstored_core.h
@@ -271,8 +271,7 @@ const char *dump_state_buffered_data(FILE *fp, const struct connection *c,
 				     const struct connection *conn,
 				     struct xs_state_connection *sc);
 const char *dump_state_nodes(FILE *fp, const void *ctx);
-const char *dump_state_node_perms(FILE *fp, struct xs_state_node *sn,
-				  const struct xs_permissions *perms,
+const char *dump_state_node_perms(FILE *fp, const struct xs_permissions *perms,
 				  unsigned int n_perms);
 
 void read_state_global(const void *ctx, const void *state);
diff --git a/tools/xenstore/xenstored_domain.c b/tools/xenstore/xenstored_domain.c
index 2d333b3ff6..0c17937c0f 100644
--- a/tools/xenstore/xenstored_domain.c
+++ b/tools/xenstore/xenstored_domain.c
@@ -1254,7 +1254,7 @@ static const char *dump_state_special_node(FILE *fp, const char *name,
 	if (fwrite(&sn, sizeof(sn), 1, fp) != 1)
 		return "Dump special node error";
 
-	ret = dump_state_node_perms(fp, &sn, perms->p, perms->num);
+	ret = dump_state_node_perms(fp, perms->p, perms->num);
 	if (ret)
 		return ret;
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu May 13 13:45:45 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 13 May 2021 13:45:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.126978.238614 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lhBer-0003Zm-7b; Thu, 13 May 2021 13:45:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 126978.238614; Thu, 13 May 2021 13:45:45 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lhBer-0003Ze-45; Thu, 13 May 2021 13:45:45 +0000
Received: by outflank-mailman (input) for mailman id 126978;
 Thu, 13 May 2021 13:45:43 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lhBep-0003ZH-PZ
 for xen-changelog@lists.xenproject.org; Thu, 13 May 2021 13:45:43 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lhBep-00036Y-Ok
 for xen-changelog@lists.xenproject.org; Thu, 13 May 2021 13:45:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lhBep-0005pq-Nz
 for xen-changelog@lists.xenproject.org; Thu, 13 May 2021 13:45:43 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=jH8XNjJtfM1s8Ojbapiy/eCVRkecnED9j0j+fDTMEy8=; b=6yIibD49dk6xnnUQXog+tKxocR
	P19J0B1fViE28IWQEu0t4LMpq0txfuc+nTAfnTtrxcpo4g8LTATo67xOAOszxLctvMkDCdpXpvedP
	EsbtP91jXKru02LaiZFqnXI6wD1Txe3AXnPLERiquLiNpUBRn1OighprTC7gr8RcxjkI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/xenstore: Fix indentation in the header of xenstored_control.c
Message-Id: <E1lhBep-0005pq-Nz@xenbits.xenproject.org>
Date: Thu, 13 May 2021 13:45:43 +0000

commit 30f34457b20c78b2862b2b16cb26cb4f10a667ad
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Mon May 10 18:28:16 2021 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Mon May 10 18:28:20 2021 +0100

    tools/xenstore: Fix indentation in the header of xenstored_control.c
    
    Commit e867af081d94 "tools/xenstore: save new binary for live update"
    seemed to have spuriously changed the indentation of the first line of
    the copyright header.
    
    The previous indentation is re-instated so all the lines are indented
    the same.
    
    Reported-by: Bjoern Doebel <doebel@amazon.com>
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
---
 tools/xenstore/xenstored_control.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/xenstore/xenstored_control.c b/tools/xenstore/xenstored_control.c
index 8e470f2b20..52d4817679 100644
--- a/tools/xenstore/xenstored_control.c
+++ b/tools/xenstore/xenstored_control.c
@@ -1,5 +1,5 @@
 /*
-Interactive commands for Xen Store Daemon.
+    Interactive commands for Xen Store Daemon.
     Copyright (C) 2017 Juergen Gross, SUSE Linux GmbH
 
     This program is free software; you can redistribute it and/or modify
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu May 13 13:45:55 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 13 May 2021 13:45:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.126979.238617 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lhBf1-0003cn-8f; Thu, 13 May 2021 13:45:55 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 126979.238617; Thu, 13 May 2021 13:45:55 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lhBf1-0003cf-5e; Thu, 13 May 2021 13:45:55 +0000
Received: by outflank-mailman (input) for mailman id 126979;
 Thu, 13 May 2021 13:45:53 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lhBez-0003cL-SN
 for xen-changelog@lists.xenproject.org; Thu, 13 May 2021 13:45:53 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lhBez-00038J-Ra
 for xen-changelog@lists.xenproject.org; Thu, 13 May 2021 13:45:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lhBez-0005qb-Qu
 for xen-changelog@lists.xenproject.org; Thu, 13 May 2021 13:45:53 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=SCcI2wWlCU7OXSr4xj/bRtKsIpHr06QS8sNXzRxGwqk=; b=XbgJw5rwToKHEBdNbUD9CphPEF
	oeYaL9lF9CfZ9WkHPv5slXqcVclW3ka7X+3FyJ1c68UsxYZyTshgcKRAjGwhXvw3YPJdB7IprlSmZ
	RhRl0OsYAe2pMPR4fw3yp0XOQoaxDCnBNpwBaW6YM8DzcJeKFtotDS3vrosDcwSkp82M=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] optee: enable OPTEE_SMC_SEC_CAP_MEMREF_NULL capability
Message-Id: <E1lhBez-0005qb-Qu@xenbits.xenproject.org>
Date: Thu, 13 May 2021 13:45:53 +0000

commit d4fb5f166c2bfbaf9ba0de69da0d411288f437a9
Author:     Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>
AuthorDate: Fri May 7 01:39:47 2021 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Mon May 10 18:35:46 2021 +0100

    optee: enable OPTEE_SMC_SEC_CAP_MEMREF_NULL capability
    
    OP-TEE mediator already have support for NULL memory references. It
    was added in patch 0dbed3ad336 ("optee: allow plain TMEM buffers with
    NULL address"). But it does not propagate
    OPTEE_SMC_SEC_CAP_MEMREF_NULL capability flag to a guest, so well
    behaving guest can't use this feature.
    
    Note: linux optee driver honors this capability flag when handling
    buffers from userspace clients, but ignores it when working with
    internal calls. For instance, __optee_enumerate_devices() function
    uses NULL argument to get buffer size hint from OP-TEE. This was the
    reason, why "optee: allow plain TMEM buffers with NULL address" was
    introduced in the first place.
    
    This patch adds the mentioned capability to list of known
    capabilities. From Linux point of view it means that userspace clients
    can use this feature, which is confirmed by OP-TEE test suite:
    
    * regression_1025 Test memref NULL and/or 0 bytes size
    o regression_1025.1 Invalid NULL buffer memref registration
      regression_1025.1 OK
    o regression_1025.2 Input/Output MEMREF Buffer NULL - Size 0 bytes
      regression_1025.2 OK
    o regression_1025.3 Input MEMREF Buffer NULL - Size non 0 bytes
      regression_1025.3 OK
    o regression_1025.4 Input MEMREF Buffer NULL over PTA invocation
      regression_1025.4 OK
      regression_1025 OK
    
    Signed-off-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/tee/optee.c            | 3 ++-
 xen/include/asm-arm/tee/optee_smc.h | 3 +++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/tee/optee.c b/xen/arch/arm/tee/optee.c
index 980eebe847..345361566e 100644
--- a/xen/arch/arm/tee/optee.c
+++ b/xen/arch/arm/tee/optee.c
@@ -96,7 +96,8 @@
 #define OPTEE_KNOWN_NSEC_CAPS OPTEE_SMC_NSEC_CAP_UNIPROCESSOR
 #define OPTEE_KNOWN_SEC_CAPS (OPTEE_SMC_SEC_CAP_HAVE_RESERVED_SHM | \
                               OPTEE_SMC_SEC_CAP_UNREGISTERED_SHM | \
-                              OPTEE_SMC_SEC_CAP_DYNAMIC_SHM)
+                              OPTEE_SMC_SEC_CAP_DYNAMIC_SHM | \
+                              OPTEE_SMC_SEC_CAP_MEMREF_NULL)
 
 enum optee_call_state {
     OPTEE_CALL_NORMAL,
diff --git a/xen/include/asm-arm/tee/optee_smc.h b/xen/include/asm-arm/tee/optee_smc.h
index d568bb2fe1..2f5c702326 100644
--- a/xen/include/asm-arm/tee/optee_smc.h
+++ b/xen/include/asm-arm/tee/optee_smc.h
@@ -244,6 +244,9 @@
  */
 #define OPTEE_SMC_SEC_CAP_DYNAMIC_SHM		(1 << 2)
 
+/* Secure world supports Shared Memory with a NULL reference */
+#define OPTEE_SMC_SEC_CAP_MEMREF_NULL		(1 << 4)
+
 #define OPTEE_SMC_FUNCID_EXCHANGE_CAPABILITIES	9
 #define OPTEE_SMC_EXCHANGE_CAPABILITIES \
 	OPTEE_SMC_FAST_CALL_VAL(OPTEE_SMC_FUNCID_EXCHANGE_CAPABILITIES)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu May 13 13:46:05 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 13 May 2021 13:46:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.126981.238621 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lhBfB-0003g7-AI; Thu, 13 May 2021 13:46:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 126981.238621; Thu, 13 May 2021 13:46:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lhBfB-0003fz-7E; Thu, 13 May 2021 13:46:05 +0000
Received: by outflank-mailman (input) for mailman id 126981;
 Thu, 13 May 2021 13:46:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lhBf9-0003fp-VL
 for xen-changelog@lists.xenproject.org; Thu, 13 May 2021 13:46:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lhBf9-000390-UY
 for xen-changelog@lists.xenproject.org; Thu, 13 May 2021 13:46:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lhBf9-0005rW-To
 for xen-changelog@lists.xenproject.org; Thu, 13 May 2021 13:46:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=zyBPcya/GcQZmvDcFiLByI98mL3zueqdx1u5UyruiZs=; b=p6VZRE/+IOAdmnTP4lUZC4yXuW
	FL14AKK8/uV3XWqq5vTr9apgEgucyM2fVGdW4oBfqgA2FHF3SedUMou2KWn38C78I2q7dN2br/Ks2
	n1v7NmA1+ZMaBFS7gxYLg3GVJZCu5zd13ieaGCTTe2GlOtoh08/AVRcL7m6RpW08mDWc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools: remove unused sysconfig variable XENSTORED_ROOTDIR
Message-Id: <E1lhBf9-0005rW-To@xenbits.xenproject.org>
Date: Thu, 13 May 2021 13:46:03 +0000

commit 52b91dad6f43afb0c77325e6d54115c280958e57
Author:     Olaf Hering <olaf@aepfle.de>
AuthorDate: Thu May 6 17:16:31 2021 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed May 12 16:25:44 2021 +0100

    tools: remove unused sysconfig variable XENSTORED_ROOTDIR
    
    The sysconfig variable XENSTORED_ROOTDIR is not used anymore.
    It used to point to a directory with tdb files, which is now a tmpfs.
    
    In case the database is not in tmpfs, like on sysv and BSD systems,
    xenstored will truncate existing database files during start.
    
    Fixes: 2ef6ace428 ("tools: don't remove tdb data base file before starting xenstored")
    Signed-off-by: Olaf Hering <olaf@aepfle.de>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Wei Liu <wl@xen.org>
---
 CHANGELOG.md                                       | 4 ++++
 tools/hotplug/FreeBSD/rc.d/xencommons.in           | 5 -----
 tools/hotplug/Linux/init.d/sysconfig.xencommons.in | 7 -------
 tools/hotplug/Linux/launch-xenstore.in             | 1 -
 tools/hotplug/NetBSD/rc.d/xencommons.in            | 5 -----
 5 files changed, 4 insertions(+), 18 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0106fccec1..6896d70757 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
 
 ## [unstable UNRELEASED](https://xenbits.xen.org/gitweb/?p=xen.git;a=shortlog;h=staging) - TBD
 
+### Removed
+ - XENSTORED_ROOTDIR environment variable from configuartion files and
+   initscripts, due to being unused.
+
 ## [4.15.0 UNRELEASED](https://xenbits.xen.org/gitweb/?p=xen.git;a=shortlog;h=RELEASE-4.15.0) - TBD
 
 ### Added / support upgraded
diff --git a/tools/hotplug/FreeBSD/rc.d/xencommons.in b/tools/hotplug/FreeBSD/rc.d/xencommons.in
index 4c61d8c94e..fddcce314c 100644
--- a/tools/hotplug/FreeBSD/rc.d/xencommons.in
+++ b/tools/hotplug/FreeBSD/rc.d/xencommons.in
@@ -42,11 +42,6 @@ xen_startcmd()
 
 	xenstored_pid=$(check_pidfile ${XENSTORED_PIDFILE} ${XENSTORED})
 	if test -z "$xenstored_pid"; then
-		printf "Cleaning xenstore database.\n"
-		if [ -z "${XENSTORED_ROOTDIR}" ]; then
-			XENSTORED_ROOTDIR="@XEN_LIB_STORED@"
-		fi
-		rm -f ${XENSTORED_ROOTDIR}/tdb* >/dev/null 2>&1
 		printf "Starting xenservices: xenstored, xenconsoled."
 		XENSTORED_ARGS=" --pid-file ${XENSTORED_PIDFILE}"
 		if [ -n "${XENSTORED_TRACE}" ]; then
diff --git a/tools/hotplug/Linux/init.d/sysconfig.xencommons.in b/tools/hotplug/Linux/init.d/sysconfig.xencommons.in
index b059a2910d..00cf7f91d4 100644
--- a/tools/hotplug/Linux/init.d/sysconfig.xencommons.in
+++ b/tools/hotplug/Linux/init.d/sysconfig.xencommons.in
@@ -48,13 +48,6 @@ XENSTORED_ARGS=
 # Only evaluated if XENSTORETYPE is "daemon".
 #XENSTORED_TRACE=[yes|on|1]
 
-## Type: string
-## Default: "@XEN_LIB_STORED@"
-#
-# Running xenstored on XENSTORED_ROOTDIR
-# Only evaluated if XENSTORETYPE is "daemon".
-#XENSTORED_ROOTDIR=@XEN_LIB_STORED@
-
 ## Type: string
 ## Default: @LIBEXEC@/boot/xenstore-stubdom.gz
 #
diff --git a/tools/hotplug/Linux/launch-xenstore.in b/tools/hotplug/Linux/launch-xenstore.in
index 991dec8d25..019f9d6f4d 100644
--- a/tools/hotplug/Linux/launch-xenstore.in
+++ b/tools/hotplug/Linux/launch-xenstore.in
@@ -53,7 +53,6 @@ test -f @CONFIG_DIR@/@CONFIG_LEAF_DIR@/xencommons && . @CONFIG_DIR@/@CONFIG_LEAF
 /bin/mkdir -p @XEN_RUN_DIR@
 
 [ "$XENSTORETYPE" = "daemon" ] && {
-	[ -z "$XENSTORED_ROOTDIR" ] && XENSTORED_ROOTDIR="@XEN_LIB_STORED@"
 	[ -z "$XENSTORED_TRACE" ] || XENSTORED_ARGS="$XENSTORED_ARGS -T @XEN_LOG_DIR@/xenstored-trace.log"
 	[ -z "$XENSTORED" ] && XENSTORED=@XENSTORED@
 	[ -x "$XENSTORED" ] || {
diff --git a/tools/hotplug/NetBSD/rc.d/xencommons.in b/tools/hotplug/NetBSD/rc.d/xencommons.in
index 80e518f5de..cf2af06596 100644
--- a/tools/hotplug/NetBSD/rc.d/xencommons.in
+++ b/tools/hotplug/NetBSD/rc.d/xencommons.in
@@ -38,11 +38,6 @@ xen_startcmd()
 
 	xenstored_pid=$(check_pidfile ${XENSTORED_PIDFILE} ${sbindir}/xenstored)
 	if test -z "$xenstored_pid"; then
-		printf "Cleaning xenstore database.\n"
-		if [ -z "${XENSTORED_ROOTDIR}" ]; then
-			XENSTORED_ROOTDIR="@XEN_LIB_STORED@"
-		fi
-		rm -f ${XENSTORED_ROOTDIR}/tdb* >/dev/null 2>&1
 		printf "Starting xenservices: xenstored, xenconsoled."
 		XENSTORED_ARGS=" --pid-file ${XENSTORED_PIDFILE}"
 		if [ -n "${XENSTORED_TRACE}" ]; then
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu May 13 13:46:15 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 13 May 2021 13:46:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.126982.238625 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lhBfL-0003ig-Bi; Thu, 13 May 2021 13:46:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 126982.238625; Thu, 13 May 2021 13:46:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lhBfL-0003iY-8k; Thu, 13 May 2021 13:46:15 +0000
Received: by outflank-mailman (input) for mailman id 126982;
 Thu, 13 May 2021 13:46:14 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lhBfK-0003iQ-2r
 for xen-changelog@lists.xenproject.org; Thu, 13 May 2021 13:46:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lhBfK-00039F-29
 for xen-changelog@lists.xenproject.org; Thu, 13 May 2021 13:46:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lhBfK-0005sH-1C
 for xen-changelog@lists.xenproject.org; Thu, 13 May 2021 13:46:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=EUkFPLZI++Z84xqzPGvQEssb/y7ud+ZJClcv/BbQ+uk=; b=0WfqZjzrRZ9aRhTtG6reGi8T3k
	8+CWgqDLd176SBASe/D+feebIE7YBK2AlglHHOka8gKBCFhRCMsBC71ApR/nxPCj04AK0gCDFk0HP
	sP5tBy2pOMDdE0NKgSp/uNRF2tTk9hLP/S2V5lgUugaQF4Q1DVMkqjK8FoTc1TX7E1RA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: gic-v3: Add missing breaks gicv3_read_apr()
Message-Id: <E1lhBfK-0005sH-1C@xenbits.xenproject.org>
Date: Thu, 13 May 2021 13:46:14 +0000

commit 43d4cc7d36503bcc3aa2aa6ebea2b7912808f254
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Wed May 12 18:35:48 2021 +0100
Commit:     Stefano Stabellini <sstabellini@kernel.org>
CommitDate: Wed May 12 13:23:48 2021 -0700

    xen/arm: gic-v3: Add missing breaks gicv3_read_apr()
    
    Commit 78e67c99eb3f "arm/gic: Get rid of READ/WRITE_SYSREG32"
    mistakenly converted all the cases in gicv3_read_apr() to fall-through.
    
    Rather than re-instating a return per case, add the missing break and
    keep a single return at the end of the fucntion.
    
    Fixes: 78e67c99eb3f ("arm/gic: Get rid of READ/WRITE_SYSREG32")
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/arch/arm/gic-v3.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/xen/arch/arm/gic-v3.c b/xen/arch/arm/gic-v3.c
index b86f040589..9a3a175ad7 100644
--- a/xen/arch/arm/gic-v3.c
+++ b/xen/arch/arm/gic-v3.c
@@ -1167,12 +1167,15 @@ static unsigned int gicv3_read_apr(int apr_reg)
     case 0:
         ASSERT(gicv3.nr_priorities > 4 && gicv3.nr_priorities < 8);
         apr = READ_SYSREG(ICH_AP1R0_EL2);
+        break;
     case 1:
         ASSERT(gicv3.nr_priorities > 5 && gicv3.nr_priorities < 8);
         apr = READ_SYSREG(ICH_AP1R1_EL2);
+        break;
     case 2:
         ASSERT(gicv3.nr_priorities > 6 && gicv3.nr_priorities < 8);
         apr = READ_SYSREG(ICH_AP1R2_EL2);
+        break;
     default:
         BUG();
     }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu May 13 17:22:15 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 13 May 2021 17:22:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.127017.238666 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lhF2G-0008Hn-K7; Thu, 13 May 2021 17:22:08 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 127017.238666; Thu, 13 May 2021 17:22:08 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lhF2G-0008Hg-HC; Thu, 13 May 2021 17:22:08 +0000
Received: by outflank-mailman (input) for mailman id 127017;
 Thu, 13 May 2021 17:22:07 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lhF2F-0008Ha-DY
 for xen-changelog@lists.xenproject.org; Thu, 13 May 2021 17:22:07 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lhF2F-0007I8-AT
 for xen-changelog@lists.xenproject.org; Thu, 13 May 2021 17:22:07 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lhF2F-0001E5-9L
 for xen-changelog@lists.xenproject.org; Thu, 13 May 2021 17:22:07 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=YVAXicNUWpr14skEGoXEmSlKwWgdU8HdQzSQboHstcw=; b=M+vlUKYLIN607HE1f4zkabE3Sn
	raMQEtgF+E5Vf2MG9gVPQLXj+mUfHOOjiEsv2/GtQd2ptW4kISxr5IO4mKoLEwrOWqXYYCesbnsn7
	6sIyGhWV74uF877YEQan0Y2nk1fG1UnA1xMtrSJXuR5X4fYsQ3Kkvg3k+B/Kt6mfVO/Q=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] Revert "x86/PV32: avoid TLB flushing after mod_l3_entry()" and "x86/PV: restrict TLB flushing after mod_l[234]_entry()"
Message-Id: <E1lhF2F-0001E5-9L@xenbits.xenproject.org>
Date: Thu, 13 May 2021 17:22:07 +0000

commit cb199cc7de987cfda4659fccf51059f210f6ad34
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu May 13 16:43:27 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu May 13 18:15:00 2021 +0100

    Revert "x86/PV32: avoid TLB flushing after mod_l3_entry()" and "x86/PV: restrict TLB flushing after mod_l[234]_entry()"
    
    These reintroduce XSA-286 / CVE-2018-15469, as confirmed by the xsa-286 XTF
    test run by OSSTest.
    
    The TLB flushing is for Xen's correctness, not the guest's.
    
    The text in c/s bed7e6cad30 is technically correct, from the guests point of
    view, but clearly false as far as XSA-286 is concerned.  That said, it is
    edcfce55917 which introduced the regression, which demonstrates that the
    reasoning is flawed.
    
    This reverts commit bed7e6cad30ec8db0c9ce9a1676856e9dc4c39da.
    This reverts commit edcfce55917bb412f986d7b28358f6ef155b3664.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/mm.c | 32 +++++++++++++++-----------------
 1 file changed, 15 insertions(+), 17 deletions(-)

diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index 84e3ccf47e..4d799032dc 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -3906,7 +3906,8 @@ long do_mmu_update(
     struct vcpu *curr = current, *v = curr;
     struct domain *d = v->domain, *pt_owner = d, *pg_owner;
     mfn_t map_mfn = INVALID_MFN, mfn;
-    bool flush_linear_pt = false, flush_root_pt_others = false;
+    bool flush_linear_pt = false, flush_root_pt_local = false,
+        flush_root_pt_others = false;
     uint32_t xsm_needed = 0;
     uint32_t xsm_checked = 0;
     int rc = put_old_guest_table(curr);
@@ -4056,9 +4057,7 @@ long do_mmu_update(
                         break;
                     rc = mod_l2_entry(va, l2e_from_intpte(req.val), mfn,
                                       cmd == MMU_PT_UPDATE_PRESERVE_AD, v);
-                    if ( !rc &&
-                         (page->u.inuse.type_info & PGT_count_mask) >
-                         1 + !!(page->u.inuse.type_info & PGT_pinned) )
+                    if ( !rc )
                         flush_linear_pt = true;
                     break;
 
@@ -4067,10 +4066,7 @@ long do_mmu_update(
                         break;
                     rc = mod_l3_entry(va, l3e_from_intpte(req.val), mfn,
                                       cmd == MMU_PT_UPDATE_PRESERVE_AD, v);
-                    if ( !rc &&
-                         (page->u.inuse.type_info & PGT_count_mask) >
-                         1 + !!(page->u.inuse.type_info & PGT_pinned) &&
-                         !is_pv_32bit_domain(pt_owner) )
+                    if ( !rc )
                         flush_linear_pt = true;
                     break;
 
@@ -4079,9 +4075,7 @@ long do_mmu_update(
                         break;
                     rc = mod_l4_entry(va, l4e_from_intpte(req.val), mfn,
                                       cmd == MMU_PT_UPDATE_PRESERVE_AD, v);
-                    if ( !rc &&
-                         (page->u.inuse.type_info & PGT_count_mask) >
-                         1 + !!(page->u.inuse.type_info & PGT_pinned) )
+                    if ( !rc )
                         flush_linear_pt = true;
                     if ( !rc && pt_owner->arch.pv.xpti )
                     {
@@ -4091,7 +4085,7 @@ long do_mmu_update(
                                     mfn) )
                         {
                             local_in_use = true;
-                            get_cpu_info()->root_pgt_changed = true;
+                            flush_root_pt_local = true;
                         }
 
                         /*
@@ -4209,7 +4203,7 @@ long do_mmu_update(
      * Perform required TLB maintenance.
      *
      * This logic currently depends on flush_linear_pt being a superset of the
-     * flush_root_pt_others condition.
+     * flush_root_pt_* conditions.
      *
      * pt_owner may not be current->domain.  This may occur during
      * construction of 32bit PV guests, or debugging of PV guests.  The
@@ -4228,7 +4222,7 @@ long do_mmu_update(
      * pt_owner->dirty_cpumask), and/or all *other* dirty CPUs as there are
      * references we can't account for locally.
      */
-    if ( flush_linear_pt /* || flush_root_pt_others */ )
+    if ( flush_linear_pt /* || flush_root_pt_local || flush_root_pt_others */ )
     {
         unsigned int cpu = smp_processor_id();
         cpumask_t *mask = pt_owner->dirty_cpumask;
@@ -4245,8 +4239,12 @@ long do_mmu_update(
             cpumask_copy(mask, pt_owner->dirty_cpumask);
             __cpumask_clear_cpu(cpu, mask);
 
-            flush_local(FLUSH_TLB);
+            flush_local(FLUSH_TLB |
+                        (flush_root_pt_local ? FLUSH_ROOT_PGTBL : 0));
         }
+        else
+            /* Sanity check.  flush_root_pt_local implies local cpu is dirty. */
+            ASSERT(!flush_root_pt_local);
 
         /* Flush the remote dirty CPUs.  Does not include the local CPU. */
         if ( !cpumask_empty(mask) )
@@ -4254,8 +4252,8 @@ long do_mmu_update(
                        (flush_root_pt_others ? FLUSH_ROOT_PGTBL : 0));
     }
     else
-        /* Sanity check.  flush_root_pt_others implies flush_linear_pt. */
-        ASSERT(!flush_root_pt_others);
+        /* Sanity check.  flush_root_pt_* implies flush_linear_pt. */
+        ASSERT(!flush_root_pt_local && !flush_root_pt_others);
 
     perfc_add(num_page_updates, i);
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri May 14 17:55:05 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 14 May 2021 17:55:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.127477.239591 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lhc1e-0004gu-Ok; Fri, 14 May 2021 17:55:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 127477.239591; Fri, 14 May 2021 17:55:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lhc1e-0004gm-Ld; Fri, 14 May 2021 17:55:02 +0000
Received: by outflank-mailman (input) for mailman id 127477;
 Fri, 14 May 2021 17:55:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lhc1d-0004ge-Rv
 for xen-changelog@lists.xenproject.org; Fri, 14 May 2021 17:55:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lhc1d-0006J3-Qz
 for xen-changelog@lists.xenproject.org; Fri, 14 May 2021 17:55:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lhc1d-0004xE-Po
 for xen-changelog@lists.xenproject.org; Fri, 14 May 2021 17:55:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=+1bAzf+iTBoo0JzY3NzoZe9xCapa/bhbHrbty8VZBQI=; b=NIRYtQjUv03ZEj3EptaFfQcEjl
	cgjUlnF9JRXTgWe5jXv7Ea2qcOUfxMcVs2LOEBVRaONt0haOeuzIwqWC6pkjOAnkI5MLyzYAP2cQD
	OK1RvFu81G4B/JPVUn7ksfLoK+6xcWjqypQv30DVUAExTmIkjviqwlHtO/b4tRHO8QwA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] Revert "x86/PV32: avoid TLB flushing after mod_l3_entry()" and "x86/PV: restrict TLB flushing after mod_l[234]_entry()"
Message-Id: <E1lhc1d-0004xE-Po@xenbits.xenproject.org>
Date: Fri, 14 May 2021 17:55:01 +0000

commit cb199cc7de987cfda4659fccf51059f210f6ad34
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu May 13 16:43:27 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu May 13 18:15:00 2021 +0100

    Revert "x86/PV32: avoid TLB flushing after mod_l3_entry()" and "x86/PV: restrict TLB flushing after mod_l[234]_entry()"
    
    These reintroduce XSA-286 / CVE-2018-15469, as confirmed by the xsa-286 XTF
    test run by OSSTest.
    
    The TLB flushing is for Xen's correctness, not the guest's.
    
    The text in c/s bed7e6cad30 is technically correct, from the guests point of
    view, but clearly false as far as XSA-286 is concerned.  That said, it is
    edcfce55917 which introduced the regression, which demonstrates that the
    reasoning is flawed.
    
    This reverts commit bed7e6cad30ec8db0c9ce9a1676856e9dc4c39da.
    This reverts commit edcfce55917bb412f986d7b28358f6ef155b3664.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/mm.c | 32 +++++++++++++++-----------------
 1 file changed, 15 insertions(+), 17 deletions(-)

diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index 84e3ccf47e..4d799032dc 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -3906,7 +3906,8 @@ long do_mmu_update(
     struct vcpu *curr = current, *v = curr;
     struct domain *d = v->domain, *pt_owner = d, *pg_owner;
     mfn_t map_mfn = INVALID_MFN, mfn;
-    bool flush_linear_pt = false, flush_root_pt_others = false;
+    bool flush_linear_pt = false, flush_root_pt_local = false,
+        flush_root_pt_others = false;
     uint32_t xsm_needed = 0;
     uint32_t xsm_checked = 0;
     int rc = put_old_guest_table(curr);
@@ -4056,9 +4057,7 @@ long do_mmu_update(
                         break;
                     rc = mod_l2_entry(va, l2e_from_intpte(req.val), mfn,
                                       cmd == MMU_PT_UPDATE_PRESERVE_AD, v);
-                    if ( !rc &&
-                         (page->u.inuse.type_info & PGT_count_mask) >
-                         1 + !!(page->u.inuse.type_info & PGT_pinned) )
+                    if ( !rc )
                         flush_linear_pt = true;
                     break;
 
@@ -4067,10 +4066,7 @@ long do_mmu_update(
                         break;
                     rc = mod_l3_entry(va, l3e_from_intpte(req.val), mfn,
                                       cmd == MMU_PT_UPDATE_PRESERVE_AD, v);
-                    if ( !rc &&
-                         (page->u.inuse.type_info & PGT_count_mask) >
-                         1 + !!(page->u.inuse.type_info & PGT_pinned) &&
-                         !is_pv_32bit_domain(pt_owner) )
+                    if ( !rc )
                         flush_linear_pt = true;
                     break;
 
@@ -4079,9 +4075,7 @@ long do_mmu_update(
                         break;
                     rc = mod_l4_entry(va, l4e_from_intpte(req.val), mfn,
                                       cmd == MMU_PT_UPDATE_PRESERVE_AD, v);
-                    if ( !rc &&
-                         (page->u.inuse.type_info & PGT_count_mask) >
-                         1 + !!(page->u.inuse.type_info & PGT_pinned) )
+                    if ( !rc )
                         flush_linear_pt = true;
                     if ( !rc && pt_owner->arch.pv.xpti )
                     {
@@ -4091,7 +4085,7 @@ long do_mmu_update(
                                     mfn) )
                         {
                             local_in_use = true;
-                            get_cpu_info()->root_pgt_changed = true;
+                            flush_root_pt_local = true;
                         }
 
                         /*
@@ -4209,7 +4203,7 @@ long do_mmu_update(
      * Perform required TLB maintenance.
      *
      * This logic currently depends on flush_linear_pt being a superset of the
-     * flush_root_pt_others condition.
+     * flush_root_pt_* conditions.
      *
      * pt_owner may not be current->domain.  This may occur during
      * construction of 32bit PV guests, or debugging of PV guests.  The
@@ -4228,7 +4222,7 @@ long do_mmu_update(
      * pt_owner->dirty_cpumask), and/or all *other* dirty CPUs as there are
      * references we can't account for locally.
      */
-    if ( flush_linear_pt /* || flush_root_pt_others */ )
+    if ( flush_linear_pt /* || flush_root_pt_local || flush_root_pt_others */ )
     {
         unsigned int cpu = smp_processor_id();
         cpumask_t *mask = pt_owner->dirty_cpumask;
@@ -4245,8 +4239,12 @@ long do_mmu_update(
             cpumask_copy(mask, pt_owner->dirty_cpumask);
             __cpumask_clear_cpu(cpu, mask);
 
-            flush_local(FLUSH_TLB);
+            flush_local(FLUSH_TLB |
+                        (flush_root_pt_local ? FLUSH_ROOT_PGTBL : 0));
         }
+        else
+            /* Sanity check.  flush_root_pt_local implies local cpu is dirty. */
+            ASSERT(!flush_root_pt_local);
 
         /* Flush the remote dirty CPUs.  Does not include the local CPU. */
         if ( !cpumask_empty(mask) )
@@ -4254,8 +4252,8 @@ long do_mmu_update(
                        (flush_root_pt_others ? FLUSH_ROOT_PGTBL : 0));
     }
     else
-        /* Sanity check.  flush_root_pt_others implies flush_linear_pt. */
-        ASSERT(!flush_root_pt_others);
+        /* Sanity check.  flush_root_pt_* implies flush_linear_pt. */
+        ASSERT(!flush_root_pt_local && !flush_root_pt_others);
 
     perfc_add(num_page_updates, i);
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon May 17 13:44:12 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 17 May 2021 13:44:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.128254.240798 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lidXS-0005k6-AP; Mon, 17 May 2021 13:44:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 128254.240798; Mon, 17 May 2021 13:44:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lidXS-0005jv-7G; Mon, 17 May 2021 13:44:06 +0000
Received: by outflank-mailman (input) for mailman id 128254;
 Mon, 17 May 2021 13:44:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lidXR-0005j0-5z
 for xen-changelog@lists.xenproject.org; Mon, 17 May 2021 13:44:05 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lidXR-0004OM-2Q
 for xen-changelog@lists.xenproject.org; Mon, 17 May 2021 13:44:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lidXR-0006yJ-1H
 for xen-changelog@lists.xenproject.org; Mon, 17 May 2021 13:44:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=2BRFYsln6s0Z36lZZd5irhfc8tKol4AgmN6x2J47qDE=; b=KSCSrM/pWCmDx4+JVhT2ae75p9
	D1rQyyjze6yqInMDZLlnrrNN7tHaj8bPbeK2c6jG9ebXoxXpylN+7NDZWJCIwFE54D0PJ2iCw7I5Y
	rzroOFsbz3y8/CpFvuv4DvNUAGsLVK7SM3kv19nHqu37wxPYBAEq1e7OSnet0Wz3qMXw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] build: centralize / unify asm-offsets generation
Message-Id: <E1lidXR-0006yJ-1H@xenbits.xenproject.org>
Date: Mon, 17 May 2021 13:44:05 +0000

commit b6ecd5c8bc0b9727f095c0bb2fedf62a565417f1
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon May 17 15:38:39 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon May 17 15:38:39 2021 +0200

    build: centralize / unify asm-offsets generation
    
    Except for an additional prereq Arm and x86 have the same needs here,
    and Arm can also benefit from the recent x86 side improvement. Recurse
    into arch/*/ only for a phony include target (doing nothing on Arm),
    and handle asm-offsets itself entirely locally to xen/Makefile.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 .gitignore            |  2 +-
 xen/Makefile          | 10 +++++++---
 xen/arch/arm/Makefile |  6 +++---
 xen/arch/x86/Makefile |  7 +++----
 4 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/.gitignore b/.gitignore
index 1c2fa1530b..c27ea80802 100644
--- a/.gitignore
+++ b/.gitignore
@@ -318,13 +318,13 @@ xen/arch/x86/efi.lds
 xen/arch/x86/efi/check.efi
 xen/arch/x86/efi/mkreloc
 xen/arch/*/xen.lds
-xen/arch/*/asm-offsets.s
 xen/arch/*/efi/boot.c
 xen/arch/*/efi/compat.c
 xen/arch/*/efi/ebmalloc.c
 xen/arch/*/efi/efi.h
 xen/arch/*/efi/pe.c
 xen/arch/*/efi/runtime.c
+xen/asm-offsets.s
 xen/common/config_data.S
 xen/common/config.gz
 xen/include/headers*.chk
diff --git a/xen/Makefile b/xen/Makefile
index 9f3be7766d..7ce7692354 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -341,7 +341,7 @@ _clean: delete-unfresh-files
 	find . \( -name "*.o" -o -name ".*.d" -o -name ".*.d2" \
 		-o -name "*.gcno" -o -name ".*.cmd" \) -exec rm -f {} \;
 	rm -f include/asm $(TARGET) $(TARGET).gz $(TARGET).efi $(TARGET).efi.map $(TARGET)-syms $(TARGET)-syms.map *~ core
-	rm -f include/asm-*/asm-offsets.h
+	rm -f asm-offsets.s include/asm-*/asm-offsets.h
 	rm -f .banner
 
 .PHONY: _distclean
@@ -362,7 +362,7 @@ $(TARGET): delete-unfresh-files
 		done; \
 		true
 	$(MAKE) -f $(BASEDIR)/Rules.mk -C include
-	$(MAKE) -f $(BASEDIR)/Rules.mk -C arch/$(TARGET_ARCH) asm-offsets.s
+	$(MAKE) -f $(BASEDIR)/Rules.mk -C arch/$(TARGET_ARCH) include
 	$(MAKE) -f $(BASEDIR)/Rules.mk include/asm-$(TARGET_ARCH)/asm-offsets.h
 	$(MAKE) -f $(BASEDIR)/Rules.mk -C arch/$(TARGET_ARCH) $@
 
@@ -399,7 +399,11 @@ include/xen/compile.h: include/xen/compile.h.in .banner
 	@sed -rf tools/process-banner.sed < .banner >> $@.new
 	@mv -f $@.new $@
 
-include/asm-$(TARGET_ARCH)/asm-offsets.h: arch/$(TARGET_ARCH)/asm-offsets.s
+asm-offsets.s: arch/$(TARGET_ARCH)/$(TARGET_SUBARCH)/asm-offsets.c
+	$(CC) $(filter-out -Wa$(comma)% -flto,$(c_flags)) -S -g0 -o $@.new -MQ $@ $<
+	$(call move-if-changed,$@.new,$@)
+
+include/asm-$(TARGET_ARCH)/asm-offsets.h: asm-offsets.s
 	@(set -e; \
 	  echo "/*"; \
 	  echo " * DO NOT MODIFY."; \
diff --git a/xen/arch/arm/Makefile b/xen/arch/arm/Makefile
index ca75f1040d..3d3b97b5b4 100644
--- a/xen/arch/arm/Makefile
+++ b/xen/arch/arm/Makefile
@@ -130,8 +130,8 @@ $(TARGET)-syms: prelink.o xen.lds
 		>$(@D)/$(@F).map
 	rm -f $(@D)/.$(@F).[0-9]*
 
-asm-offsets.s: $(TARGET_SUBARCH)/asm-offsets.c
-	$(CC) $(filter-out -flto,$(c_flags)) -S -o $@ $<
+.PHONY: include
+include:
 
 xen.lds: xen.lds.S
 	$(CPP) -P $(a_flags) -D__LINKER__ -MQ $@ -o $@ $<
@@ -140,6 +140,6 @@ dtb.o: $(patsubst "%",%,$(CONFIG_DTB_FILE))
 
 .PHONY: clean
 clean::
-	rm -f asm-offsets.s xen.lds
+	rm -f xen.lds
 	rm -f $(BASEDIR)/.xen-syms.[0-9]*
 	rm -f $(TARGET).efi
diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile
index ada085d17a..1f5887afc4 100644
--- a/xen/arch/x86/Makefile
+++ b/xen/arch/x86/Makefile
@@ -272,9 +272,8 @@ endif
 efi/buildid.o efi/relocs-dummy.o: $(BASEDIR)/arch/x86/efi/built_in.o
 efi/buildid.o efi/relocs-dummy.o: ;
 
-asm-offsets.s: $(TARGET_SUBARCH)/asm-offsets.c $(BASEDIR)/include/asm-x86/asm-macros.h
-	$(CC) $(filter-out -Wa$(comma)% -flto,$(c_flags)) -S -g0 -o $@.new -MQ $@ $<
-	$(call move-if-changed,$@.new,$@)
+.PHONY: include
+include: $(BASEDIR)/include/asm-x86/asm-macros.h
 
 asm-macros.i: CFLAGS-y += -D__ASSEMBLY__ -P
 
@@ -304,7 +303,7 @@ efi/mkreloc: efi/mkreloc.c
 
 .PHONY: clean
 clean::
-	rm -f asm-offsets.s *.lds *.new boot/*.o boot/*~ boot/core boot/mkelf32
+	rm -f *.lds *.new boot/*.o boot/*~ boot/core boot/mkelf32
 	rm -f asm-macros.i $(BASEDIR)/include/asm-x86/asm-macros.*
 	rm -f $(BASEDIR)/.xen-syms.[0-9]* boot/.*.d $(BASEDIR)/.xen.elf32
 	rm -f $(BASEDIR)/.xen.efi.[0-9]* efi/*.efi efi/mkreloc
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon May 17 13:44:16 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 17 May 2021 13:44:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.128255.240802 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lidXc-0005n1-Bt; Mon, 17 May 2021 13:44:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 128255.240802; Mon, 17 May 2021 13:44:16 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lidXc-0005mt-92; Mon, 17 May 2021 13:44:16 +0000
Received: by outflank-mailman (input) for mailman id 128255;
 Mon, 17 May 2021 13:44:15 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lidXb-0005me-6X
 for xen-changelog@lists.xenproject.org; Mon, 17 May 2021 13:44:15 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lidXb-0004OQ-5m
 for xen-changelog@lists.xenproject.org; Mon, 17 May 2021 13:44:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lidXb-0006z5-4k
 for xen-changelog@lists.xenproject.org; Mon, 17 May 2021 13:44:15 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=sqkcVLY+AZWzXyIGdthPAXscH8wnVywNFdN2URCso2U=; b=kk7e2YkBL71mXmHWH4Ns/D3DIp
	nZXwmTzm/vTAmy1lh7xDuu9ntkWA8axY1P0LTmy6QvIQO82UWSpP9y9YQUwRZBLWyvtkM2HGDYKl3
	4cyofpU9m+pct8kTaxJYZL16Y9tJtBHzDNRQdyCInCNafdpIFDejnx99exAKhlfK5Vsg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/AMD: also determine L3 cache size
Message-Id: <E1lidXb-0006z5-4k@xenbits.xenproject.org>
Date: Mon, 17 May 2021 13:44:15 +0000

commit 12a963b22b02a377ddb6a46db304fa4a0eee8c39
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon May 17 15:40:53 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon May 17 15:40:53 2021 +0200

    x86/AMD: also determine L3 cache size
    
    For Intel CPUs we record L3 cache size, hence we should also do so for
    AMD and alike.
    
    While making these additions, also make sure (throughout the function)
    that we don't needlessly overwrite prior values when the new value to be
    stored is zero.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/cpu/common.c | 39 ++++++++++++++++++++++++++-------------
 1 file changed, 26 insertions(+), 13 deletions(-)

diff --git a/xen/arch/x86/cpu/common.c b/xen/arch/x86/cpu/common.c
index 0eb364f8a6..302f7f35d8 100644
--- a/xen/arch/x86/cpu/common.c
+++ b/xen/arch/x86/cpu/common.c
@@ -240,28 +240,41 @@ int get_model_name(struct cpuinfo_x86 *c)
 
 void display_cacheinfo(struct cpuinfo_x86 *c)
 {
-	unsigned int dummy, ecx, edx, l2size;
+	unsigned int dummy, ecx, edx, size;
 
 	if (c->extended_cpuid_level >= 0x80000005) {
 		cpuid(0x80000005, &dummy, &dummy, &ecx, &edx);
-		if (opt_cpu_info)
-			printk("CPU: L1 I cache %dK (%d bytes/line),"
-			              " D cache %dK (%d bytes/line)\n",
-			       edx>>24, edx&0xFF, ecx>>24, ecx&0xFF);
-		c->x86_cache_size=(ecx>>24)+(edx>>24);	
+		if ((edx | ecx) >> 24) {
+			if (opt_cpu_info)
+				printk("CPU: L1 I cache %uK (%u bytes/line),"
+				              " D cache %uK (%u bytes/line)\n",
+				       edx >> 24, edx & 0xFF, ecx >> 24, ecx & 0xFF);
+			c->x86_cache_size = (ecx >> 24) + (edx >> 24);
+		}
 	}
 
 	if (c->extended_cpuid_level < 0x80000006)	/* Some chips just has a large L1. */
 		return;
 
-	ecx = cpuid_ecx(0x80000006);
-	l2size = ecx >> 16;
-	
-	c->x86_cache_size = l2size;
+	cpuid(0x80000006, &dummy, &dummy, &ecx, &edx);
 
-	if (opt_cpu_info)
-		printk("CPU: L2 Cache: %dK (%d bytes/line)\n",
-		       l2size, ecx & 0xFF);
+	size = ecx >> 16;
+	if (size) {
+		c->x86_cache_size = size;
+
+		if (opt_cpu_info)
+			printk("CPU: L2 Cache: %uK (%u bytes/line)\n",
+			       size, ecx & 0xFF);
+	}
+
+	size = edx >> 18;
+	if (size) {
+		c->x86_cache_size = size * 512;
+
+		if (opt_cpu_info)
+			printk("CPU: L3 Cache: %uM (%u bytes/line)\n",
+			       (size + (size & 1)) >> 1, edx & 0xFF);
+	}
 }
 
 static inline u32 _phys_pkg_id(u32 cpuid_apic, int index_msb)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon May 17 13:44:27 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 17 May 2021 13:44:27 +0000
Received: from list by lists.xenproject.org with outflank-mailman.128256.240806 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lidXn-0005q0-Dm; Mon, 17 May 2021 13:44:27 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 128256.240806; Mon, 17 May 2021 13:44:27 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lidXn-0005pt-AX; Mon, 17 May 2021 13:44:27 +0000
Received: by outflank-mailman (input) for mailman id 128256;
 Mon, 17 May 2021 13:44:25 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lidXl-0005pX-9i
 for xen-changelog@lists.xenproject.org; Mon, 17 May 2021 13:44:25 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lidXl-0004Oi-92
 for xen-changelog@lists.xenproject.org; Mon, 17 May 2021 13:44:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lidXl-0006zz-82
 for xen-changelog@lists.xenproject.org; Mon, 17 May 2021 13:44:25 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=DtSK6dmtBn8dYejpW/cl9jWf2eMjM8aL4fY8G13H/jk=; b=fO5aQnuTNifcVQ8ybWaqIN8dJw
	bWLK42Hc9S8ehDjNoj4GdJgCzJlGqK4fh7gKYSF3S27hS1jSLtFZws8jyfc6VblnBYsb+7BzqcnbU
	NoF3qhMQ7kuBIc8RxmgAkKqtfFveHkovQJTVJbR9XeaBC8eNWN6fFBGZ2jaJNx9xzq3k=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86emul: fix test harness build for gas 2.36
Message-Id: <E1lidXl-0006zz-82@xenbits.xenproject.org>
Date: Mon, 17 May 2021 13:44:25 +0000

commit aa803ba38a867551917d11059eaa044955556e05
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon May 17 15:41:28 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon May 17 15:41:28 2021 +0200

    x86emul: fix test harness build for gas 2.36
    
    All of the sudden, besides .text and .rodata and alike, an always
    present .note.gnu.property section has appeared. This section, when
    converting to binary format output, gets placed according to its
    linked address, causing the resulting blobs to be about 128Mb in size.
    The resulting headers with a C representation of the binary blobs then
    are, of course all a multiple of that size (and take accordingly long
    to create). I didn't bother waiting to see what size the final
    test_x86_emulator binary then would have had.
    
    See also https://sourceware.org/bugzilla/show_bug.cgi?id=27753.
    
    Rather than figuring out whether gas supports -mx86-used-note=, simply
    remove the section while creating *.bin.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
---
 tools/tests/x86_emulator/testcase.mk | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/tests/x86_emulator/testcase.mk b/tools/tests/x86_emulator/testcase.mk
index dafeb6caf7..d4aa82e3f3 100644
--- a/tools/tests/x86_emulator/testcase.mk
+++ b/tools/tests/x86_emulator/testcase.mk
@@ -12,11 +12,11 @@ all: $(TESTCASE).bin
 %.bin: %.c
 	$(CC) $(filter-out -M% .%,$(CFLAGS)) -c $<
 	$(LD) $(LDFLAGS_DIRECT) -N -Ttext 0x100000 -o $*.tmp $*.o
-	$(OBJCOPY) -O binary $*.tmp $@
+	$(OBJCOPY) -O binary -R .note.gnu.property $*.tmp $@
 	rm -f $*.tmp
 
 %-opmask.bin: opmask.S
 	$(CC) $(filter-out -M% .%,$(CFLAGS)) -c $< -o $(basename $@).o
 	$(LD) $(LDFLAGS_DIRECT) -N -Ttext 0x100000 -o $(basename $@).tmp $(basename $@).o
-	$(OBJCOPY) -O binary $(basename $@).tmp $@
+	$(OBJCOPY) -O binary -R .note.gnu.property $(basename $@).tmp $@
 	rm -f $(basename $@).tmp
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon May 17 13:44:37 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 17 May 2021 13:44:37 +0000
Received: from list by lists.xenproject.org with outflank-mailman.128257.240810 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lidXx-0005tS-FK; Mon, 17 May 2021 13:44:37 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 128257.240810; Mon, 17 May 2021 13:44:37 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lidXx-0005tK-CF; Mon, 17 May 2021 13:44:37 +0000
Received: by outflank-mailman (input) for mailman id 128257;
 Mon, 17 May 2021 13:44:35 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lidXv-0005st-Co
 for xen-changelog@lists.xenproject.org; Mon, 17 May 2021 13:44:35 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lidXv-0004Ou-C6
 for xen-changelog@lists.xenproject.org; Mon, 17 May 2021 13:44:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lidXv-00070w-BE
 for xen-changelog@lists.xenproject.org; Mon, 17 May 2021 13:44:35 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=k0LN6PTC62Ub21eOXolUb2ZBlI//B8GpaCXy7DJ1H/4=; b=Dx2yz2ph4hKbti8Akrxz36D/cN
	UfI6JO3N2EaNdz+kF2rm3QcylB06pHEw2e/+9tl7CYOMvVMSYWn4fUFLeMhYQ+T+J30YvM5OSvNsL
	Vt4UuJ/+Hq9ksa1MxzSHXNZ9NrGUpFChYJkC3J66DtWIoEB69ODUtLWXlxwa2S4moD50=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/shim: fix build when !PV32
Message-Id: <E1lidXv-00070w-BE@xenbits.xenproject.org>
Date: Mon, 17 May 2021 13:44:35 +0000

commit bd1e7b47bac00735a47055e2cba4106b54175138
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon May 17 15:42:00 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon May 17 15:42:00 2021 +0200

    x86/shim: fix build when !PV32
    
    In this case compat headers don't get generated (and aren't needed).
    The changes made by 527922008bce ("x86: slim down hypercall handling
    when !PV32") also weren't quite sufficient for this case.
    
    Try to limit #ifdef-ary by introducing two "fallback" #define-s.
    
    Fixes: d23d792478db ("x86: avoid building COMPAT code when !HVM && !PV32")
    Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/pv/shim.c | 23 +++++++++++++++++++----
 1 file changed, 19 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/pv/shim.c b/xen/arch/x86/pv/shim.c
index 4c6f442274..8164a0fbde 100644
--- a/xen/arch/x86/pv/shim.c
+++ b/xen/arch/x86/pv/shim.c
@@ -34,8 +34,6 @@
 #include <public/arch-x86/cpuid.h>
 #include <public/hvm/params.h>
 
-#include <compat/grant_table.h>
-
 #undef virt_to_mfn
 #define virt_to_mfn(va) _mfn(__virt_to_mfn(va))
 
@@ -300,8 +298,10 @@ static void write_start_info(struct domain *d)
                                           &si->console.domU.mfn) )
         BUG();
 
+#ifdef CONFIG_PV32
     if ( compat )
         xlat_start_info(si, XLAT_start_info_console_domU);
+#endif
 
     unmap_domain_page(si);
 }
@@ -675,6 +675,13 @@ void pv_shim_inject_evtchn(unsigned int port)
     }
 }
 
+#ifdef CONFIG_PV32
+# include <compat/grant_table.h>
+#else
+# define compat_gnttab_setup_table gnttab_setup_table
+# define compat_handle_okay guest_handle_okay
+#endif
+
 static long pv_shim_grant_table_op(unsigned int cmd,
                                    XEN_GUEST_HANDLE_PARAM(void) uop,
                                    unsigned int count)
@@ -704,10 +711,13 @@ static long pv_shim_grant_table_op(unsigned int cmd,
             rc = -EFAULT;
             break;
         }
+
+#ifdef CONFIG_PV32
         if ( compat )
 #define XLAT_gnttab_setup_table_HNDL_frame_list(d, s)
             XLAT_gnttab_setup_table(&nat, &cmp);
 #undef XLAT_gnttab_setup_table_HNDL_frame_list
+#endif
 
         nat.status = GNTST_okay;
 
@@ -778,6 +788,7 @@ static long pv_shim_grant_table_op(unsigned int cmd,
             }
 
             ASSERT(grant_frames[i]);
+#ifdef CONFIG_PV32
             if ( compat )
             {
                 compat_pfn_t pfn = grant_frames[i];
@@ -789,8 +800,10 @@ static long pv_shim_grant_table_op(unsigned int cmd,
                     break;
                 }
             }
-            else if ( __copy_to_guest_offset(nat.frame_list, i,
-                                             &grant_frames[i], 1) )
+            else
+#endif
+            if ( __copy_to_guest_offset(nat.frame_list, i,
+                                        &grant_frames[i], 1) )
             {
                 nat.status = GNTST_bad_virt_addr;
                 rc = -EFAULT;
@@ -799,10 +812,12 @@ static long pv_shim_grant_table_op(unsigned int cmd,
         }
         spin_unlock(&grant_lock);
 
+#ifdef CONFIG_PV32
         if ( compat )
 #define XLAT_gnttab_setup_table_HNDL_frame_list(d, s)
             XLAT_gnttab_setup_table(&cmp, &nat);
 #undef XLAT_gnttab_setup_table_HNDL_frame_list
+#endif
 
         if ( unlikely(compat ? __copy_to_guest(uop, &cmp, 1)
                              : __copy_to_guest(uop, &nat, 1)) )
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon May 17 13:44:47 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 17 May 2021 13:44:47 +0000
Received: from list by lists.xenproject.org with outflank-mailman.128258.240814 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lidY7-0005xR-Gf; Mon, 17 May 2021 13:44:47 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 128258.240814; Mon, 17 May 2021 13:44:47 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lidY7-0005xJ-Dl; Mon, 17 May 2021 13:44:47 +0000
Received: by outflank-mailman (input) for mailman id 128258;
 Mon, 17 May 2021 13:44:45 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lidY5-0005x0-G7
 for xen-changelog@lists.xenproject.org; Mon, 17 May 2021 13:44:45 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lidY5-0004P5-FH
 for xen-changelog@lists.xenproject.org; Mon, 17 May 2021 13:44:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lidY5-00071q-EH
 for xen-changelog@lists.xenproject.org; Mon, 17 May 2021 13:44:45 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=OCdsMhTCwxUfM2sf5VySJE/Bv6GKWyYmyFTPv5KhFM4=; b=zCfXugfgn+sSp+0A9Pez3Is7IT
	bFGeM75XKVnj2HV8e/UKaE7JoBpMW/BgPFq1954c/nEYQyl3O1Xy/gJHNDIk310B7eJqO8stBrEc6
	23Hq9asHqwyZyBJsLhuTY/F0j9tF4U4jsvwhJkho8syuc2lLkYf4Wnd6HsCfMseIACYQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] Argo/XSM: add SILO hooks
Message-Id: <E1lidY5-00071q-EH@xenbits.xenproject.org>
Date: Mon, 17 May 2021 13:44:45 +0000

commit 599bca58849effbac4ef03a5986d20e38e26a854
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon May 17 15:42:32 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon May 17 15:42:32 2021 +0200

    Argo/XSM: add SILO hooks
    
    In SILO mode restrictions for inter-domain communication should apply
    here along the lines of those for evtchn and gnttab.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Daniel P. Smith <dpsmith@apertussolutions.com>
---
 xen/xsm/silo.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/xen/xsm/silo.c b/xen/xsm/silo.c
index 4850756a3d..fc2ca5cd2d 100644
--- a/xen/xsm/silo.c
+++ b/xen/xsm/silo.c
@@ -81,12 +81,35 @@ static int silo_grant_copy(struct domain *d1, struct domain *d2)
     return -EPERM;
 }
 
+#ifdef CONFIG_ARGO
+
+static int silo_argo_register_single_source(const struct domain *d1,
+                                            const struct domain *d2)
+{
+    if ( silo_mode_dom_check(d1, d2) )
+        return xsm_argo_register_single_source(d1, d2);
+    return -EPERM;
+}
+
+static int silo_argo_send(const struct domain *d1, const struct domain *d2)
+{
+    if ( silo_mode_dom_check(d1, d2) )
+        return xsm_argo_send(d1, d2);
+    return -EPERM;
+}
+
+#endif
+
 static struct xsm_operations silo_xsm_ops = {
     .evtchn_unbound = silo_evtchn_unbound,
     .evtchn_interdomain = silo_evtchn_interdomain,
     .grant_mapref = silo_grant_mapref,
     .grant_transfer = silo_grant_transfer,
     .grant_copy = silo_grant_copy,
+#ifdef CONFIG_ARGO
+    .argo_register_single_source = silo_argo_register_single_source,
+    .argo_send = silo_argo_send,
+#endif
 };
 
 void __init silo_init(void)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon May 17 13:44:57 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 17 May 2021 13:44:57 +0000
Received: from list by lists.xenproject.org with outflank-mailman.128259.240818 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lidYH-0005zy-I2; Mon, 17 May 2021 13:44:57 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 128259.240818; Mon, 17 May 2021 13:44:57 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lidYH-0005zq-FF; Mon, 17 May 2021 13:44:57 +0000
Received: by outflank-mailman (input) for mailman id 128259;
 Mon, 17 May 2021 13:44:55 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lidYF-0005ze-J0
 for xen-changelog@lists.xenproject.org; Mon, 17 May 2021 13:44:55 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lidYF-0004PF-IE
 for xen-changelog@lists.xenproject.org; Mon, 17 May 2021 13:44:55 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lidYF-00072r-HP
 for xen-changelog@lists.xenproject.org; Mon, 17 May 2021 13:44:55 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=A59MwTtGqXBUXd1EO7+3DJR5ZSDpnvITGETcFla50nE=; b=HSb0waW2CslZHaOJWID+XBmRSI
	EkLn6TCMEGfqX9AQol0N8Oxgoc/TU9b0DQFwsMPsnJ5GG845MMTwXD44mfLNBinYQfKPv3iIWRsS3
	dCHLIaqSw4FmSht1ZU5kf8Yw7tcZYsAgUXMbUGwyhij+LFvqKCCDPSBhRixfKREBKBXY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] include/public: add RING_RESPONSE_PROD_OVERFLOW macro
Message-Id: <E1lidYF-00072r-HP@xenbits.xenproject.org>
Date: Mon, 17 May 2021 13:44:55 +0000

commit d1f6296053f464c9da6f6fa5f1ece864130718ce
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Mon May 17 15:43:04 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon May 17 15:43:04 2021 +0200

    include/public: add RING_RESPONSE_PROD_OVERFLOW macro
    
    Add a new RING_RESPONSE_PROD_OVERFLOW() macro for being able to
    detect an ill-behaved backend tampering with the response producer
    index.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/include/public/io/ring.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/xen/include/public/io/ring.h b/xen/include/public/io/ring.h
index 0b08b2697e..c486c457e0 100644
--- a/xen/include/public/io/ring.h
+++ b/xen/include/public/io/ring.h
@@ -259,6 +259,10 @@ typedef struct __name##_back_ring __name##_back_ring_t
 #define RING_REQUEST_PROD_OVERFLOW(_r, _prod)                           \
     (((_prod) - (_r)->rsp_prod_pvt) > RING_SIZE(_r))
 
+/* Ill-behaved backend determination: Can there be this many responses? */
+#define RING_RESPONSE_PROD_OVERFLOW(_r, _prod)                          \
+    (((_prod) - (_r)->rsp_cons) > RING_SIZE(_r))
+
 #define RING_PUSH_REQUESTS(_r) do {                                     \
     xen_wmb(); /* back sees requests /before/ updated producer index */ \
     (_r)->sring->req_prod = (_r)->req_prod_pvt;                         \
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon May 17 13:45:07 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 17 May 2021 13:45:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.128260.240822 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lidYR-00062l-KG; Mon, 17 May 2021 13:45:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 128260.240822; Mon, 17 May 2021 13:45:07 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lidYR-00062d-Gp; Mon, 17 May 2021 13:45:07 +0000
Received: by outflank-mailman (input) for mailman id 128260;
 Mon, 17 May 2021 13:45:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lidYP-00062J-Lx
 for xen-changelog@lists.xenproject.org; Mon, 17 May 2021 13:45:05 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lidYP-0004QC-LA
 for xen-changelog@lists.xenproject.org; Mon, 17 May 2021 13:45:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lidYP-00073z-KK
 for xen-changelog@lists.xenproject.org; Mon, 17 May 2021 13:45:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=93khFNp03QCmZ/0xesIIa5M4G/xShwlfjF75RJK2ETU=; b=4Ev2+Bwd0aUXFvT+kFMTSxFFMZ
	DRR7mhAZFKvv/Yp6ovgLrqSH38BOFhxmkL1+jGlDRxXon2aHrMshOOO32+vyIlHYmIOM6CpLU0dux
	GuHqvBF86mTLoEUa5bWMNmCGGVwnV73VXbb98PliESD9EB2Y519XSDC0hq8cRy//NV4k=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen: fix build when !CONFIG_GRANT_TABLE
Message-Id: <E1lidYP-00073z-KK@xenbits.xenproject.org>
Date: Mon, 17 May 2021 13:45:05 +0000

commit 71a25d03b70b399d666d05a3d0046d821248c80e
Author:     Connor Davis <connojdavis@gmail.com>
AuthorDate: Mon May 17 15:43:19 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon May 17 15:43:19 2021 +0200

    xen: fix build when !CONFIG_GRANT_TABLE
    
    Move struct grant_table; in grant_table.h above
    ifdef CONFIG_GRANT_TABLE. This fixes the following:
    
    /build/xen/include/xen/grant_table.h:84:50: error: 'struct grant_table'
    declared inside parameter list will not be visible outside of this
    definition or declaration [-Werror]
       84 | static inline int mem_sharing_gref_to_gfn(struct grant_table *gt,
          |
    
    Signed-off-by: Connor Davis <connojdavis@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/include/xen/grant_table.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/include/xen/grant_table.h b/xen/include/xen/grant_table.h
index 63b6dc78f4..9f8b7e66c1 100644
--- a/xen/include/xen/grant_table.h
+++ b/xen/include/xen/grant_table.h
@@ -28,9 +28,10 @@
 #include <public/grant_table.h>
 #include <asm/grant_table.h>
 
-#ifdef CONFIG_GRANT_TABLE
 struct grant_table;
 
+#ifdef CONFIG_GRANT_TABLE
+
 extern unsigned int opt_max_grant_frames;
 
 /* Create/destroy per-domain grant table context. */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon May 17 16:11:11 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 17 May 2021 16:11:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.128414.241083 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lifpi-0000W5-A3; Mon, 17 May 2021 16:11:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 128414.241083; Mon, 17 May 2021 16:11:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lifpi-0000Vx-6j; Mon, 17 May 2021 16:11:06 +0000
Received: by outflank-mailman (input) for mailman id 128414;
 Mon, 17 May 2021 16:11:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lifph-0000Vr-2d
 for xen-changelog@lists.xenproject.org; Mon, 17 May 2021 16:11:05 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lifpg-0007cG-W6
 for xen-changelog@lists.xenproject.org; Mon, 17 May 2021 16:11:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lifpg-0002Sm-V3
 for xen-changelog@lists.xenproject.org; Mon, 17 May 2021 16:11:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=sLPpj+3vqvYKIzG3MDU8MHBfKPc4NciS8JJ+3FX3ODA=; b=wBZOdIv3mRIdEptnVqhSHJk6jN
	K8H6i18yR3B+UidEcV0cvd6ZFzRJWMT7/xblcpMnDdUsBkDiiakY2Sq9rGwcoffPv17qBOl1c5Z1D
	HWvOUufrl0UbaRXaor8wbigY2Rkm68vAvHszRV9R5Tooa4vCCNWfRo6z3KNwLmSIVeQI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: kernel: Propagate the error if we fail to decompress the kernel
Message-Id: <E1lifpg-0002Sm-V3@xenbits.xenproject.org>
Date: Mon, 17 May 2021 16:11:04 +0000

commit 27eb6833134d0f3ddfb02d09055776e837e9a747
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Apr 6 20:15:54 2021 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Mon May 17 17:09:40 2021 +0100

    xen/arm: kernel: Propagate the error if we fail to decompress the kernel
    
    Currently, we are ignoring any error from perform_gunzip() and replacing
    the compressed kernel with the "uncompressed" kernel.
    
    If there is a gzip failure, then it means that the output buffer may
    contain garbagge. So it can result to various sort of behavior that may
    be difficult to root cause.
    
    In case of failure, free the output buffer and propagate the error.
    We also need to adjust the return check for kernel_compress() as
    perform_gunzip() may return a positive value.
    
    Take the opportunity to adjust the code style for the check.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Michal Orzel <michal.orzel@arm.com>
---
 xen/arch/arm/kernel.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/kernel.c b/xen/arch/arm/kernel.c
index ab78689ed2..8f43caa186 100644
--- a/xen/arch/arm/kernel.c
+++ b/xen/arch/arm/kernel.c
@@ -292,6 +292,12 @@ static __init int kernel_decompress(struct bootmodule *mod)
     iounmap(input);
     vunmap(output);
 
+    if ( rc )
+    {
+        free_domheap_pages(pages, kernel_order_out);
+        return rc;
+    }
+
     mod->start = page_to_maddr(pages);
     mod->size = output_size;
 
@@ -503,7 +509,7 @@ int __init kernel_probe(struct kernel_info *info,
 
     /* if it is a gzip'ed image, 32bit or 64bit, uncompress it */
     rc = kernel_decompress(mod);
-    if (rc < 0 && rc != -EINVAL)
+    if ( rc && rc != -EINVAL )
         return rc;
 
 #ifdef CONFIG_ARM_64
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon May 17 18:00:11 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 17 May 2021 18:00:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.128451.241154 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lihXC-0005IF-Km; Mon, 17 May 2021 18:00:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 128451.241154; Mon, 17 May 2021 18:00:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lihXC-0005I7-Ha; Mon, 17 May 2021 18:00:06 +0000
Received: by outflank-mailman (input) for mailman id 128451;
 Mon, 17 May 2021 18:00:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lihXB-0005A2-6f
 for xen-changelog@lists.xenproject.org; Mon, 17 May 2021 18:00:05 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lihXB-000167-30
 for xen-changelog@lists.xenproject.org; Mon, 17 May 2021 18:00:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lihXB-00081d-1t
 for xen-changelog@lists.xenproject.org; Mon, 17 May 2021 18:00:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=9Ho7rFuNynsLbrszsz/3YcfaSgre+bhSn4aZVTA8K9I=; b=wis0QB1/CMdNjN1LxM9q/Y07Ja
	uBA3nYLf1esD0gWT+3dhdSdfT3F7tkCDpmVJ2uPyWASFU9/XcNkAx48PmJn82fQXncEFlG+b6FmIZ
	PiNM95c3DesKNxRiOp2bDGs4oeyCcJi2EQSlTJnXAjVSLAq0p6r4n3RQRYlyQENuZhyQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/xenstore: cleanup Makefile and gitignore
Message-Id: <E1lihXB-00081d-1t@xenbits.xenproject.org>
Date: Mon, 17 May 2021 18:00:05 +0000

commit 3ac8835a80b27fc4e7116dbde78d3eececc66fc9
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Fri May 14 11:01:16 2021 +0200
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Mon May 17 18:56:43 2021 +0100

    tools/xenstore: cleanup Makefile and gitignore
    
    The Makefile of xenstore and related to that the global .gitignore
    file contain some leftovers from ancient times. Remove those.
    
    While at it sort the tools/xenstore/* entries in .gitignore.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 .gitignore              | 7 +++----
 tools/xenstore/Makefile | 2 +-
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/.gitignore b/.gitignore
index c27ea80802..38a085e398 100644
--- a/.gitignore
+++ b/.gitignore
@@ -288,15 +288,15 @@ tools/xenpaging/xenpaging
 tools/xenpmd/xenpmd
 tools/xenstore/xenstore
 tools/xenstore/xenstore-chmod
+tools/xenstore/xenstore-control
 tools/xenstore/xenstore-exists
 tools/xenstore/xenstore-list
+tools/xenstore/xenstore-ls
 tools/xenstore/xenstore-read
 tools/xenstore/xenstore-rm
+tools/xenstore/xenstore-watch
 tools/xenstore/xenstore-write
-tools/xenstore/xenstore-control
-tools/xenstore/xenstore-ls
 tools/xenstore/xenstored
-tools/xenstore/xenstored_test
 tools/xenstore/xs_tdb_dump
 tools/xentop/xentop
 tools/xentrace/xentrace_setsize
@@ -428,7 +428,6 @@ tools/firmware/etherboot/ipxe.tar.gz
 tools/firmware/etherboot/ipxe/
 tools/python/xen/lowlevel/xl/_pyxl_types.c
 tools/python/xen/lowlevel/xl/_pyxl_types.h
-tools/xenstore/xenstore-watch
 tools/xl/_paths.h
 tools/xl/xl
 
diff --git a/tools/xenstore/Makefile b/tools/xenstore/Makefile
index ab89e22d3a..8ced12c27e 100644
--- a/tools/xenstore/Makefile
+++ b/tools/xenstore/Makefile
@@ -90,7 +90,7 @@ xs_tdb_dump: xs_tdb_dump.o utils.o tdb.o talloc.o
 .PHONY: clean
 clean:
 	rm -f *.a *.o xenstored_probes.h
-	rm -f xenstored xs_random xs_stress xs_crashme
+	rm -f xenstored
 	rm -f xs_tdb_dump xenstore-control init-xenstore-domain
 	rm -f xenstore $(CLIENTS)
 	$(RM) $(DEPS_RM)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue May 18 12:55:13 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 18 May 2021 12:55:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.129180.242503 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lizFZ-0006rP-PO; Tue, 18 May 2021 12:55:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 129180.242503; Tue, 18 May 2021 12:55:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lizFZ-0006rF-M1; Tue, 18 May 2021 12:55:05 +0000
Received: by outflank-mailman (input) for mailman id 129180;
 Tue, 18 May 2021 12:55:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lizFZ-0006r7-DJ
 for xen-changelog@lists.xenproject.org; Tue, 18 May 2021 12:55:05 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lizFZ-0002sY-CU
 for xen-changelog@lists.xenproject.org; Tue, 18 May 2021 12:55:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lizFZ-0004w4-BV
 for xen-changelog@lists.xenproject.org; Tue, 18 May 2021 12:55:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=24IsqfxJY8wc90DN6eDnloVjple+Pjrm1cvS1V8KGoA=; b=nzqtEhAjLdJAh9RRfntitirVhB
	xNbycrSkNartt/1fq+7SSDobHa0nOLK59sE9H5rNDbDpWP2TMWBJYg218e+7JJru6dI2lN+hVQNAi
	Cu4Qya6dK0a1KLht62FtEoec3zfn55x/+XaDEhIYciU19Sa8TK+StplCzfUizSxtyi/g=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/xenstore: move per connection read and write func hooks into a struct
Message-Id: <E1lizFZ-0004w4-BV@xenbits.xenproject.org>
Date: Tue, 18 May 2021 12:55:05 +0000

commit 8b9890e1c0f5b35c199f40eb4e6cd0ce6c34829b
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Tue May 18 08:19:06 2021 +0200
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Tue May 18 13:51:23 2021 +0100

    tools/xenstore: move per connection read and write func hooks into a struct
    
    Put the interface type specific functions into an own structure and let
    struct connection contain only a pointer to that new function vector.
    
    Don't even define the socket based functions in case of NO_SOCKETS
    (Mini-OS).
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
---
 tools/xenstore/xenstored_core.c   | 44 ++++++++++++++++-----------------------
 tools/xenstore/xenstored_core.h   | 21 ++++++++++---------
 tools/xenstore/xenstored_domain.c | 13 ++++++++++--
 3 files changed, 40 insertions(+), 38 deletions(-)

diff --git a/tools/xenstore/xenstored_core.c b/tools/xenstore/xenstored_core.c
index 02ae390e25..340654855a 100644
--- a/tools/xenstore/xenstored_core.c
+++ b/tools/xenstore/xenstored_core.c
@@ -226,8 +226,8 @@ static bool write_messages(struct connection *conn)
 				sockmsg_string(out->hdr.msg.type),
 				out->hdr.msg.len,
 				out->buffer, conn);
-		ret = conn->write(conn, out->hdr.raw + out->used,
-				  sizeof(out->hdr) - out->used);
+		ret = conn->funcs->write(conn, out->hdr.raw + out->used,
+					 sizeof(out->hdr) - out->used);
 		if (ret < 0)
 			return false;
 
@@ -243,8 +243,8 @@ static bool write_messages(struct connection *conn)
 			return true;
 	}
 
-	ret = conn->write(conn, out->buffer + out->used,
-			  out->hdr.msg.len - out->used);
+	ret = conn->funcs->write(conn, out->buffer + out->used,
+				 out->hdr.msg.len - out->used);
 	if (ret < 0)
 		return false;
 
@@ -1532,8 +1532,8 @@ static void handle_input(struct connection *conn)
 	/* Not finished header yet? */
 	if (in->inhdr) {
 		if (in->used != sizeof(in->hdr)) {
-			bytes = conn->read(conn, in->hdr.raw + in->used,
-					   sizeof(in->hdr) - in->used);
+			bytes = conn->funcs->read(conn, in->hdr.raw + in->used,
+						  sizeof(in->hdr) - in->used);
 			if (bytes < 0)
 				goto bad_client;
 			in->used += bytes;
@@ -1558,8 +1558,8 @@ static void handle_input(struct connection *conn)
 		in->inhdr = false;
 	}
 
-	bytes = conn->read(conn, in->buffer + in->used,
-			   in->hdr.msg.len - in->used);
+	bytes = conn->funcs->read(conn, in->buffer + in->used,
+				  in->hdr.msg.len - in->used);
 	if (bytes < 0)
 		goto bad_client;
 
@@ -1582,7 +1582,7 @@ static void handle_output(struct connection *conn)
 		ignore_connection(conn);
 }
 
-struct connection *new_connection(connwritefn_t *write, connreadfn_t *read)
+struct connection *new_connection(const struct interface_funcs *funcs)
 {
 	struct connection *new;
 
@@ -1592,8 +1592,7 @@ struct connection *new_connection(connwritefn_t *write, connreadfn_t *read)
 
 	new->fd = -1;
 	new->pollfd_idx = -1;
-	new->write = write;
-	new->read = read;
+	new->funcs = funcs;
 	new->is_ignored = false;
 	new->transaction_started = 0;
 	INIT_LIST_HEAD(&new->out_list);
@@ -1622,20 +1621,8 @@ struct connection *get_connection_by_id(unsigned int conn_id)
 static void accept_connection(int sock)
 {
 }
-
-int writefd(struct connection *conn, const void *data, unsigned int len)
-{
-	errno = EBADF;
-	return -1;
-}
-
-int readfd(struct connection *conn, void *data, unsigned int len)
-{
-	errno = EBADF;
-	return -1;
-}
 #else
-int writefd(struct connection *conn, const void *data, unsigned int len)
+static int writefd(struct connection *conn, const void *data, unsigned int len)
 {
 	int rc;
 
@@ -1651,7 +1638,7 @@ int writefd(struct connection *conn, const void *data, unsigned int len)
 	return rc;
 }
 
-int readfd(struct connection *conn, void *data, unsigned int len)
+static int readfd(struct connection *conn, void *data, unsigned int len)
 {
 	int rc;
 
@@ -1673,6 +1660,11 @@ int readfd(struct connection *conn, void *data, unsigned int len)
 	return rc;
 }
 
+const struct interface_funcs socket_funcs = {
+	.write = writefd,
+	.read = readfd,
+};
+
 static void accept_connection(int sock)
 {
 	int fd;
@@ -1682,7 +1674,7 @@ static void accept_connection(int sock)
 	if (fd < 0)
 		return;
 
-	conn = new_connection(writefd, readfd);
+	conn = new_connection(&socket_funcs);
 	if (conn)
 		conn->fd = fd;
 	else
diff --git a/tools/xenstore/xenstored_core.h b/tools/xenstore/xenstored_core.h
index b50ea3f57d..199f6c777a 100644
--- a/tools/xenstore/xenstored_core.h
+++ b/tools/xenstore/xenstored_core.h
@@ -86,8 +86,11 @@ struct delayed_request {
 };
 
 struct connection;
-typedef int connwritefn_t(struct connection *, const void *, unsigned int);
-typedef int connreadfn_t(struct connection *, void *, unsigned int);
+
+struct interface_funcs {
+	int (*write)(struct connection *, const void *, unsigned int);
+	int (*read)(struct connection *, void *, unsigned int);
+};
 
 struct connection
 {
@@ -131,9 +134,8 @@ struct connection
 	/* My watches. */
 	struct list_head watches;
 
-	/* Methods for communicating over this connection: write can be NULL */
-	connwritefn_t *write;
-	connreadfn_t *read;
+	/* Methods for communicating over this connection. */
+	const struct interface_funcs *funcs;
 
 	/* Support for live update: connection id. */
 	unsigned int conn_id;
@@ -196,7 +198,7 @@ int write_node_raw(struct connection *conn, TDB_DATA *key, struct node *node,
 struct node *read_node(struct connection *conn, const void *ctx,
 		       const char *name);
 
-struct connection *new_connection(connwritefn_t *write, connreadfn_t *read);
+struct connection *new_connection(const struct interface_funcs *funcs);
 struct connection *get_connection_by_id(unsigned int conn_id);
 void check_store(void);
 void corrupt(struct connection *conn, const char *fmt, ...);
@@ -256,10 +258,9 @@ void finish_daemonize(void);
 /* Open a pipe for signal handling */
 void init_pipe(int reopen_log_pipe[2]);
 
-int writefd(struct connection *conn, const void *data, unsigned int len);
-int readfd(struct connection *conn, void *data, unsigned int len);
-
-extern struct interface_funcs socket_funcs;
+#ifndef NO_SOCKETS
+extern const struct interface_funcs socket_funcs;
+#endif
 extern xengnttab_handle **xgt_handle;
 
 int remember_string(struct hashtable *hash, const char *str);
diff --git a/tools/xenstore/xenstored_domain.c b/tools/xenstore/xenstored_domain.c
index 0c17937c0f..f3cd56050e 100644
--- a/tools/xenstore/xenstored_domain.c
+++ b/tools/xenstore/xenstored_domain.c
@@ -172,6 +172,11 @@ static int readchn(struct connection *conn, void *data, unsigned int len)
 	return len;
 }
 
+static const struct interface_funcs domain_funcs = {
+	.write = writechn,
+	.read = readchn,
+};
+
 static void *map_interface(domid_t domid)
 {
 	return xengnttab_map_grant_ref(*xgt_handle, domid,
@@ -389,7 +394,7 @@ static int new_domain(struct domain *domain, int port, bool restore)
 
 	domain->introduced = true;
 
-	domain->conn = new_connection(writechn, readchn);
+	domain->conn = new_connection(&domain_funcs);
 	if (!domain->conn)  {
 		errno = ENOMEM;
 		return errno;
@@ -1288,10 +1293,14 @@ void read_state_connection(const void *ctx, const void *state)
 	struct domain *domain, *tdomain;
 
 	if (sc->conn_type == XS_STATE_CONN_TYPE_SOCKET) {
-		conn = new_connection(writefd, readfd);
+#ifdef NO_SOCKETS
+		barf("socket based connection without sockets");
+#else
+		conn = new_connection(&socket_funcs);
 		if (!conn)
 			barf("error restoring connection");
 		conn->fd = sc->spec.socket_fd;
+#endif
 	} else {
 		domain = introduce_domain(ctx, sc->spec.ring.domid,
 					  sc->spec.ring.evtchn, true);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue May 18 12:55:16 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 18 May 2021 12:55:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.129181.242506 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lizFk-0006ta-Qa; Tue, 18 May 2021 12:55:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 129181.242506; Tue, 18 May 2021 12:55:16 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lizFk-0006tS-Ng; Tue, 18 May 2021 12:55:16 +0000
Received: by outflank-mailman (input) for mailman id 129181;
 Tue, 18 May 2021 12:55:15 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lizFj-0006tI-HH
 for xen-changelog@lists.xenproject.org; Tue, 18 May 2021 12:55:15 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lizFj-0002sv-GQ
 for xen-changelog@lists.xenproject.org; Tue, 18 May 2021 12:55:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lizFj-0004xE-F6
 for xen-changelog@lists.xenproject.org; Tue, 18 May 2021 12:55:15 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=F2/WSexsY6zyxIOZAdRHMDa3qdphRCfMQnesYxEK4Ec=; b=wPLDoQ1rW5Bitx63560JeIaf08
	7/JGFf5ebFLlQuO5rV8sI49sVKmVuWkYIXRO4p3nzZV+uk7nc6CSwHhZCUd2OB6jdZWNSDtnjrG1z
	QW/qJgIhuMxc6lN8P2kBBVG9sXI+IEvCXyFQRkLMqbA9qVN+FewlEWr4TYGZ1X69KIxk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/xenstore: simplify xenstored main loop
Message-Id: <E1lizFj-0004xE-F6@xenbits.xenproject.org>
Date: Tue, 18 May 2021 12:55:15 +0000

commit caa9c4471d1d74b2d236467aaf7e63a806ac11a4
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Tue May 18 08:19:07 2021 +0200
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Tue May 18 13:51:28 2021 +0100

    tools/xenstore: simplify xenstored main loop
    
    The main loop of xenstored is rather complicated due to different
    handling of socket and ring-page interfaces. Unify that handling by
    introducing interface type specific functions can_read() and
    can_write().
    
    Take the opportunity to remove the empty list check before calling
    write_messages() because the function is already able to cope with an
    empty list.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
---
 tools/xenstore/xenstored_core.c   | 77 +++++++++++++++++++--------------------
 tools/xenstore/xenstored_core.h   |  2 +
 tools/xenstore/xenstored_domain.c |  2 +
 3 files changed, 41 insertions(+), 40 deletions(-)

diff --git a/tools/xenstore/xenstored_core.c b/tools/xenstore/xenstored_core.c
index 340654855a..df1e54c1f8 100644
--- a/tools/xenstore/xenstored_core.c
+++ b/tools/xenstore/xenstored_core.c
@@ -1660,9 +1660,34 @@ static int readfd(struct connection *conn, void *data, unsigned int len)
 	return rc;
 }
 
+static bool socket_can_process(struct connection *conn, int mask)
+{
+	if (conn->pollfd_idx == -1)
+		return false;
+
+	if (fds[conn->pollfd_idx].revents & ~(POLLIN | POLLOUT)) {
+		talloc_free(conn);
+		return false;
+	}
+
+	return (fds[conn->pollfd_idx].revents & mask) && !conn->is_ignored;
+}
+
+static bool socket_can_write(struct connection *conn)
+{
+	return socket_can_process(conn, POLLOUT);
+}
+
+static bool socket_can_read(struct connection *conn)
+{
+	return socket_can_process(conn, POLLIN);
+}
+
 const struct interface_funcs socket_funcs = {
 	.write = writefd,
 	.read = readfd,
+	.can_write = socket_can_write,
+	.can_read = socket_can_read,
 };
 
 static void accept_connection(int sock)
@@ -2297,47 +2322,19 @@ int main(int argc, char *argv[])
 			if (&next->list != &connections)
 				talloc_increase_ref_count(next);
 
-			if (conn->domain) {
-				if (domain_can_read(conn))
-					handle_input(conn);
-				if (talloc_free(conn) == 0)
-					continue;
-
-				talloc_increase_ref_count(conn);
-				if (domain_can_write(conn) &&
-				    !list_empty(&conn->out_list))
-					handle_output(conn);
-				if (talloc_free(conn) == 0)
-					continue;
-			} else {
-				if (conn->pollfd_idx != -1) {
-					if (fds[conn->pollfd_idx].revents
-					    & ~(POLLIN|POLLOUT))
-						talloc_free(conn);
-					else if ((fds[conn->pollfd_idx].revents
-						  & POLLIN) &&
-						 !conn->is_ignored)
-						handle_input(conn);
-				}
-				if (talloc_free(conn) == 0)
-					continue;
-
-				talloc_increase_ref_count(conn);
-
-				if (conn->pollfd_idx != -1) {
-					if (fds[conn->pollfd_idx].revents
-					    & ~(POLLIN|POLLOUT))
-						talloc_free(conn);
-					else if ((fds[conn->pollfd_idx].revents
-						  & POLLOUT) &&
-						 !conn->is_ignored)
-						handle_output(conn);
-				}
-				if (talloc_free(conn) == 0)
-					continue;
+			if (conn->funcs->can_read(conn))
+				handle_input(conn);
+			if (talloc_free(conn) == 0)
+				continue;
 
-				conn->pollfd_idx = -1;
-			}
+			talloc_increase_ref_count(conn);
+
+			if (conn->funcs->can_write(conn))
+				handle_output(conn);
+			if (talloc_free(conn) == 0)
+				continue;
+
+			conn->pollfd_idx = -1;
 		}
 
 		if (delayed_requests) {
diff --git a/tools/xenstore/xenstored_core.h b/tools/xenstore/xenstored_core.h
index 199f6c777a..da43ec0e02 100644
--- a/tools/xenstore/xenstored_core.h
+++ b/tools/xenstore/xenstored_core.h
@@ -90,6 +90,8 @@ struct connection;
 struct interface_funcs {
 	int (*write)(struct connection *, const void *, unsigned int);
 	int (*read)(struct connection *, void *, unsigned int);
+	bool (*can_write)(struct connection *);
+	bool (*can_read)(struct connection *);
 };
 
 struct connection
diff --git a/tools/xenstore/xenstored_domain.c b/tools/xenstore/xenstored_domain.c
index f3cd56050e..708bf68af0 100644
--- a/tools/xenstore/xenstored_domain.c
+++ b/tools/xenstore/xenstored_domain.c
@@ -175,6 +175,8 @@ static int readchn(struct connection *conn, void *data, unsigned int len)
 static const struct interface_funcs domain_funcs = {
 	.write = writechn,
 	.read = readchn,
+	.can_write = domain_can_write,
+	.can_read = domain_can_read,
 };
 
 static void *map_interface(domid_t domid)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue May 18 14:00:13 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 18 May 2021 14:00:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.129230.242586 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lj0GU-0006ye-I9; Tue, 18 May 2021 14:00:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 129230.242586; Tue, 18 May 2021 14:00:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lj0GU-0006yU-EB; Tue, 18 May 2021 14:00:06 +0000
Received: by outflank-mailman (input) for mailman id 129230;
 Tue, 18 May 2021 14:00:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lj0GT-0006mZ-2e
 for xen-changelog@lists.xenproject.org; Tue, 18 May 2021 14:00:05 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lj0GS-00044b-Vq
 for xen-changelog@lists.xenproject.org; Tue, 18 May 2021 14:00:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lj0GS-0001aV-T3
 for xen-changelog@lists.xenproject.org; Tue, 18 May 2021 14:00:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=l5Xb1C037PT2nIUjRx+mA4isvysw5QQIVZBjUJnrhF0=; b=OG7Vm1wz0JFWPyyzPyTJaQhTiN
	CpBPs2D8IFRzziaM54OSZIbMwjxUQCDYEYgikf0/rhk5CCQko1S4JKM5Qr5weeZ1kfPbrjLK/rNOD
	dm6klE5I5/+L1tj43qQcVR0A6p3tCBZ9woaCoLY1f7R2qPqEudgxh55/smkvDh3jsQs8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/libs: guest: Use const whenever we point to literal strings
Message-Id: <E1lj0GS-0001aV-T3@xenbits.xenproject.org>
Date: Tue, 18 May 2021 14:00:04 +0000

commit 8fc4916daf2aac34088ebd5ec3d6fd707ac4221d
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue May 18 14:34:22 2021 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Tue May 18 14:54:05 2021 +0100

    tools/libs: guest: Use const whenever we point to literal strings
    
    literal strings are not meant to be modified. So we should use const
    *char rather than char * when we want to store a pointer to them.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
    Acked-by: Wei Liu <wl@xen.org>
---
 tools/include/xenguest.h            | 10 +++++-----
 tools/libs/guest/xg_dom_core.c      |  8 ++++----
 tools/libs/guest/xg_dom_elfloader.c |  4 ++--
 tools/libs/guest/xg_dom_hvmloader.c |  2 +-
 tools/libs/guest/xg_dom_x86.c       |  7 ++++---
 tools/libs/guest/xg_private.h       |  2 +-
 6 files changed, 17 insertions(+), 16 deletions(-)

diff --git a/tools/include/xenguest.h b/tools/include/xenguest.h
index 217022b6e7..a4492038cf 100644
--- a/tools/include/xenguest.h
+++ b/tools/include/xenguest.h
@@ -108,7 +108,7 @@ struct xc_dom_image {
 
     /* info from (elf) kernel image */
     struct elf_dom_parms *parms;
-    char *guest_type;
+    const char *guest_type;
 
     /* memory layout */
     struct xc_dom_seg kernel_seg;
@@ -266,8 +266,8 @@ struct xc_dom_arch {
     /* arch-specific memory initialization. */
     int (*meminit) (struct xc_dom_image * dom);
 
-    char *guest_type;
-    char *native_protocol;
+    const char *guest_type;
+    const char *native_protocol;
     int page_shift;
     int sizeof_pfn;
     int p2m_base_supported;
@@ -374,9 +374,9 @@ char *xc_dom_strdup(struct xc_dom_image *dom, const char *str);
 
 /* --- alloc memory pool ------------------------------------------- */
 
-xen_pfn_t xc_dom_alloc_page(struct xc_dom_image *dom, char *name);
+xen_pfn_t xc_dom_alloc_page(struct xc_dom_image *dom, const char *name);
 int xc_dom_alloc_segment(struct xc_dom_image *dom,
-                         struct xc_dom_seg *seg, char *name,
+                         struct xc_dom_seg *seg, const char *name,
                          xen_vaddr_t start, xen_vaddr_t size);
 
 /* --- misc bits --------------------------------------------------- */
diff --git a/tools/libs/guest/xg_dom_core.c b/tools/libs/guest/xg_dom_core.c
index 98ef8e8fc9..4918ee517b 100644
--- a/tools/libs/guest/xg_dom_core.c
+++ b/tools/libs/guest/xg_dom_core.c
@@ -422,7 +422,7 @@ void *xc_dom_pfn_to_ptr_retcount(struct xc_dom_image *dom, xen_pfn_t pfn,
     struct xc_dom_phys *phys;
     xen_pfn_t offset;
     unsigned int page_shift = XC_DOM_PAGE_SHIFT(dom);
-    char *mode = "unset";
+    const char *mode = "unset";
 
     *count_out = 0;
 
@@ -525,7 +525,7 @@ void *xc_dom_pfn_to_ptr_retcount(struct xc_dom_image *dom, xen_pfn_t pfn,
     return phys->ptr;
 }
 
-static int xc_dom_chk_alloc_pages(struct xc_dom_image *dom, char *name,
+static int xc_dom_chk_alloc_pages(struct xc_dom_image *dom, const char *name,
                                   xen_pfn_t pages)
 {
     unsigned int page_size = XC_DOM_PAGE_SIZE(dom);
@@ -576,7 +576,7 @@ static int xc_dom_alloc_pad(struct xc_dom_image *dom, xen_vaddr_t boundary)
 }
 
 int xc_dom_alloc_segment(struct xc_dom_image *dom,
-                         struct xc_dom_seg *seg, char *name,
+                         struct xc_dom_seg *seg, const char *name,
                          xen_vaddr_t start, xen_vaddr_t size)
 {
     unsigned int page_size = XC_DOM_PAGE_SIZE(dom);
@@ -611,7 +611,7 @@ int xc_dom_alloc_segment(struct xc_dom_image *dom,
     return 0;
 }
 
-xen_pfn_t xc_dom_alloc_page(struct xc_dom_image *dom, char *name)
+xen_pfn_t xc_dom_alloc_page(struct xc_dom_image *dom, const char *name)
 {
     xen_vaddr_t start;
     xen_pfn_t pfn;
diff --git a/tools/libs/guest/xg_dom_elfloader.c b/tools/libs/guest/xg_dom_elfloader.c
index 06e713fe11..0d6247db5d 100644
--- a/tools/libs/guest/xg_dom_elfloader.c
+++ b/tools/libs/guest/xg_dom_elfloader.c
@@ -50,8 +50,8 @@ void xc_elf_set_logfile(xc_interface *xch, struct elf_binary *elf,
 
 /* ------------------------------------------------------------------------ */
 
-static char *xc_dom_guest_type(struct xc_dom_image *dom,
-                               struct elf_binary *elf)
+static const char *xc_dom_guest_type(struct xc_dom_image *dom,
+                                     struct elf_binary *elf)
 {
     uint64_t machine = elf_uval(elf, elf->ehdr, e_machine);
 
diff --git a/tools/libs/guest/xg_dom_hvmloader.c b/tools/libs/guest/xg_dom_hvmloader.c
index ec6ebad7fd..4e6f30858a 100644
--- a/tools/libs/guest/xg_dom_hvmloader.c
+++ b/tools/libs/guest/xg_dom_hvmloader.c
@@ -130,7 +130,7 @@ static elf_errorstatus xc_dom_parse_hvm_kernel(struct xc_dom_image *dom)
 
 static int module_init_one(struct xc_dom_image *dom,
                            struct xc_hvm_firmware_module *module,
-                           char *name)
+                           const char *name)
 {
     struct xc_dom_seg seg;
     void *dest;
diff --git a/tools/libs/guest/xg_dom_x86.c b/tools/libs/guest/xg_dom_x86.c
index 2953aeb90b..d2eb89ce01 100644
--- a/tools/libs/guest/xg_dom_x86.c
+++ b/tools/libs/guest/xg_dom_x86.c
@@ -1148,10 +1148,11 @@ static int vcpu_hvm(struct xc_dom_image *dom)
 
 /* ------------------------------------------------------------------------ */
 
-static int x86_compat(xc_interface *xch, uint32_t domid, char *guest_type)
+static int x86_compat(xc_interface *xch, uint32_t domid,
+                      const char *guest_type)
 {
     static const struct {
-        char           *guest;
+        const char      *guest;
         uint32_t        size;
     } types[] = {
         { "xen-3.0-x86_32p", 32 },
@@ -1664,7 +1665,7 @@ static int bootearly(struct xc_dom_image *dom)
 static int bootlate_pv(struct xc_dom_image *dom)
 {
     static const struct {
-        char *guest;
+        const char *guest;
         unsigned long pgd_type;
     } types[] = {
         { "xen-3.0-x86_32",  MMUEXT_PIN_L2_TABLE},
diff --git a/tools/libs/guest/xg_private.h b/tools/libs/guest/xg_private.h
index 8f9b257a2f..25e46d7ce1 100644
--- a/tools/libs/guest/xg_private.h
+++ b/tools/libs/guest/xg_private.h
@@ -43,7 +43,7 @@
 #endif
 
 struct xc_dom_loader {
-    char *name;
+    const char *name;
     /* Sadly the error returns from these functions are not consistent: */
     elf_negerrnoval (*probe) (struct xc_dom_image * dom);
     elf_negerrnoval (*parser) (struct xc_dom_image * dom);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue May 18 14:00:16 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 18 May 2021 14:00:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.129231.242588 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lj0Ge-00074D-JS; Tue, 18 May 2021 14:00:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 129231.242588; Tue, 18 May 2021 14:00:16 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lj0Ge-000745-G3; Tue, 18 May 2021 14:00:16 +0000
Received: by outflank-mailman (input) for mailman id 129231;
 Tue, 18 May 2021 14:00:15 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lj0Gd-00073v-3g
 for xen-changelog@lists.xenproject.org; Tue, 18 May 2021 14:00:15 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lj0Gd-00044v-2q
 for xen-changelog@lists.xenproject.org; Tue, 18 May 2021 14:00:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lj0Gd-0001cE-1x
 for xen-changelog@lists.xenproject.org; Tue, 18 May 2021 14:00:15 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=R8XWCL51bZaqq9481jnv0C+5GebTnZLFiDHFp7D56io=; b=Zg0eGVdNpma+acLri84GjVQuBt
	pAzCerICpFrgVhnYgDiJaVWrqNH9Y89aaCQpNpHSM4wFWB7OoKLKNeXelIllA7/KJPKlEU418M5IU
	P30mWnhbBnjMvhPeym8PTi+UGOg1nzoVw8mkrXYnCn5t3MjOttbNUASPfHzeRUDHBgFM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/libs: stat: Use const whenever we point to literal strings
Message-Id: <E1lj0Gd-0001cE-1x@xenbits.xenproject.org>
Date: Tue, 18 May 2021 14:00:15 +0000

commit 89aae4ad8f495b647de33f2df5046b3ce68225f8
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue May 18 14:35:07 2021 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Tue May 18 14:54:05 2021 +0100

    tools/libs: stat: Use const whenever we point to literal strings
    
    literal strings are not meant to be modified. So we should use const
    char * rather than char * when we want to store a pointer to them.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
    Acked-by: Wei Liu <wl@xen.org>
---
 tools/libs/stat/xenstat_linux.c |  4 ++--
 tools/libs/stat/xenstat_qmp.c   | 12 ++++++------
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/tools/libs/stat/xenstat_linux.c b/tools/libs/stat/xenstat_linux.c
index c00b26d4d8..875a0617ad 100644
--- a/tools/libs/stat/xenstat_linux.c
+++ b/tools/libs/stat/xenstat_linux.c
@@ -66,7 +66,7 @@ static const char PROCNETDEV_HEADER[] =
 
 /* We need to get the name of the bridge interface for use with bonding interfaces */
 /* Use excludeName parameter to avoid adding bridges we don't care about, eg. virbr0 */
-static void getBridge(char *excludeName, char *result, size_t resultLen)
+static void getBridge(const char *excludeName, char *result, size_t resultLen)
 {
 	struct dirent *de;
 	DIR *d;
@@ -113,7 +113,7 @@ static int parseNetDevLine(char *line, char *iface, unsigned long long *rxBytes,
 	int num = 19;
 
 	/* Regular exception to parse all the information from /proc/net/dev line */
-	char *regex = "([^:]*):([^ ]*)[ ]*([^ ]*)[ ]*([^ ]*)[ ]*([^ ]*)[ ]*([^ ]*)[ ]*([^ ]*)"
+	const char *regex = "([^:]*):([^ ]*)[ ]*([^ ]*)[ ]*([^ ]*)[ ]*([^ ]*)[ ]*([^ ]*)[ ]*([^ ]*)"
 			"[ ]*([^ ]*)[ ]*([^ ]*)[ ]*([^ ]*)[ ]*([^ ]*)[ ]*([^ ]*)[ ]*([^ ]*)[ ]*"
 			"([^ ]*)[ ]*([^ ]*)[ ]*([^ ]*)[ ]*([^ ]*)[ ]*([^ ]*)";
 
diff --git a/tools/libs/stat/xenstat_qmp.c b/tools/libs/stat/xenstat_qmp.c
index 0c5748ba68..2205a04131 100644
--- a/tools/libs/stat/xenstat_qmp.c
+++ b/tools/libs/stat/xenstat_qmp.c
@@ -38,7 +38,7 @@
 
 #include <yajl/yajl_tree.h>
 
-static unsigned char *qmp_query(int, char *);
+static unsigned char *qmp_query(int, const char *);
 
 enum query_blockstats {
     QMP_STATS_RETURN  = 0,
@@ -80,7 +80,7 @@ enum query_block {
 static char *qmp_get_block_image(xenstat_node *node, char *qmp_devname, int qfd)
 {
 	char *tmp, *file = NULL;
-	char *query_block_cmd = "{ \"execute\": \"query-block\" }";
+	const char *query_block_cmd = "{ \"execute\": \"query-block\" }";
 	static const char *const qblock[] = {
 		[ QMP_BLOCK_RETURN  ] = "return",
 		[ QMP_BLOCK_DEVICE  ] = "device",
@@ -264,7 +264,7 @@ done:
 }
 
 /* Write a command via the QMP. Returns number of bytes written */
-static size_t qmp_write(int qfd, char *cmd, size_t cmd_len)
+static size_t qmp_write(int qfd, const char *cmd, size_t cmd_len)
 {
 	size_t pos = 0;
 	ssize_t res;
@@ -317,7 +317,7 @@ static int qmp_read(int qfd, unsigned char **qstats)
 }
 
 /* With the given cmd, query QMP for requested data. Returns allocated buffer containing data or NULL */
-static unsigned char *qmp_query(int qfd, char *cmd)
+static unsigned char *qmp_query(int qfd, const char *cmd)
 {
 	unsigned char *qstats = NULL;
 	int n;
@@ -385,8 +385,8 @@ static int qmp_connect(char *path)
 */
 static void read_attributes_qdisk_dom(xenstat_node *node, domid_t domain)
 {
-	char *cmd_mode = "{ \"execute\": \"qmp_capabilities\" }";
-	char *query_blockstats_cmd = "{ \"execute\": \"query-blockstats\" }";
+	const char *cmd_mode = "{ \"execute\": \"qmp_capabilities\" }";
+	const char *query_blockstats_cmd = "{ \"execute\": \"query-blockstats\" }";
 	unsigned char *qmp_stats, *val;
 	char path[80];
 	int qfd;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue May 18 14:00:26 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 18 May 2021 14:00:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.129232.242593 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lj0Go-00077f-MI; Tue, 18 May 2021 14:00:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 129232.242593; Tue, 18 May 2021 14:00:26 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lj0Go-00077X-JQ; Tue, 18 May 2021 14:00:26 +0000
Received: by outflank-mailman (input) for mailman id 129232;
 Tue, 18 May 2021 14:00:25 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lj0Gn-00077N-7p
 for xen-changelog@lists.xenproject.org; Tue, 18 May 2021 14:00:25 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lj0Gn-000456-71
 for xen-changelog@lists.xenproject.org; Tue, 18 May 2021 14:00:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lj0Gn-0001dr-5R
 for xen-changelog@lists.xenproject.org; Tue, 18 May 2021 14:00:25 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=6V0UIRWOHgDxF5u+9817N7LPj84lPRJkn0aZvXckpws=; b=qJkoW493TpFYCTMuicTB6o6c3S
	YhOccP38Ggdo8hlqpRt1xFBQ5tt875zXC+D+L6lX1/JKJqh6wBulXbgs2R6jU4vwHbfyc5beg6RuD
	E1VMX2KrC2WMk5JP03g4cTFEWkV2N0WFnOVhJE1gB3qUGAeJNYDXqb/Fzp/z8zR3xNPg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/misc: Use const whenever we point to literal strings
Message-Id: <E1lj0Gn-0001dr-5R@xenbits.xenproject.org>
Date: Tue, 18 May 2021 14:00:25 +0000

commit 5605cfd49a18df41a21fb50cd81528312a39d7c9
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue May 18 14:50:32 2021 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Tue May 18 14:54:05 2021 +0100

    tools/misc: Use const whenever we point to literal strings
    
    literal strings are not meant to be modified. So we should use const
    char * rather than char * when we we to store a pointer to them.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
    Acked-by: Wei Liu <wl@xen.org>
---
 tools/misc/xen-detect.c | 2 +-
 tools/misc/xenhypfs.c   | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/misc/xen-detect.c b/tools/misc/xen-detect.c
index eac9e46a35..18b28dabf3 100644
--- a/tools/misc/xen-detect.c
+++ b/tools/misc/xen-detect.c
@@ -44,7 +44,7 @@ enum guest_type {
     XEN_NONE = 3
 };
 
-static char *type;
+static const char *type;
 static char *ver;
 
 static void cpuid(uint32_t idx, uint32_t *regs, int pv_context)
diff --git a/tools/misc/xenhypfs.c b/tools/misc/xenhypfs.c
index 5da24aed90..df398b07bd 100644
--- a/tools/misc/xenhypfs.c
+++ b/tools/misc/xenhypfs.c
@@ -81,9 +81,9 @@ static int xenhypfs_wr(char *path, char *val)
     return ret;
 }
 
-static char *xenhypfs_type(struct xenhypfs_dirent *ent)
+static const char *xenhypfs_type(struct xenhypfs_dirent *ent)
 {
-    char *res;
+    const char *res;
 
     switch (ent->type) {
     case xenhypfs_type_dir:
@@ -134,7 +134,7 @@ static int xenhypfs_ls(char *path)
     return ret;
 }
 
-static int xenhypfs_tree_sub(char *path, unsigned int depth)
+static int xenhypfs_tree_sub(const char *path, unsigned int depth)
 {
     struct xenhypfs_dirent *ent;
     unsigned int n, i;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue May 18 14:00:36 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 18 May 2021 14:00:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.129233.242597 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lj0Gy-0007BN-Nl; Tue, 18 May 2021 14:00:36 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 129233.242597; Tue, 18 May 2021 14:00:36 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lj0Gy-0007BF-Kw; Tue, 18 May 2021 14:00:36 +0000
Received: by outflank-mailman (input) for mailman id 129233;
 Tue, 18 May 2021 14:00:35 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lj0Gx-0007Ay-Ay
 for xen-changelog@lists.xenproject.org; Tue, 18 May 2021 14:00:35 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lj0Gx-00045G-AE
 for xen-changelog@lists.xenproject.org; Tue, 18 May 2021 14:00:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lj0Gx-0001f5-9J
 for xen-changelog@lists.xenproject.org; Tue, 18 May 2021 14:00:35 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=68CZ8Ujoc7iHM8JPgq66yEwPsUUdqx+jlaAs0GUoxiQ=; b=qoK7FLh5Bjvr8Z1YJ97TBxMGD2
	9kkmRP8C0KBNrnHP1fBrN3QzLNbVFY544hpSOQdXRLpqRlPh9qYX6cyxv9sivFMtEH0WB7lT17sGC
	4HFVHHlHretx0pWBp4UjOt36DXAZ0FnPm+pWc7RMLBThz+bzqCQqHt2tpe1aNNDSKs6Q=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/top: The string parameter in set_prompt() and set_delay() should be const
Message-Id: <E1lj0Gx-0001f5-9J@xenbits.xenproject.org>
Date: Tue, 18 May 2021 14:00:35 +0000

commit 4b7702727a8d89fea0a239adcbeb18aa2c85ede0
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue May 18 14:51:28 2021 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Tue May 18 14:54:05 2021 +0100

    tools/top: The string parameter in set_prompt() and set_delay() should be const
    
    Neither string parameter in set_prompt() and set_delay() are meant to
    be modified. In particular, new_prompt can point to a literal string.
    
    So mark the two parameters as const and propagate it.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
    Acked-by: Wei Liu <wl@xen.org>
---
 tools/xentop/xentop.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/tools/xentop/xentop.c b/tools/xentop/xentop.c
index ebed070c0f..950e8935c4 100644
--- a/tools/xentop/xentop.c
+++ b/tools/xentop/xentop.c
@@ -81,8 +81,8 @@ static int current_row(void);
 static int lines(void);
 static void print(const char *, ...) __attribute__((format(printf,1,2)));
 static void attr_addstr(int attr, const char *str);
-static void set_delay(char *value);
-static void set_prompt(char *new_prompt, void (*func)(char *));
+static void set_delay(const char *value);
+static void set_prompt(const char *new_prompt, void (*func)(const char *));
 static int handle_key(int);
 static int compare(unsigned long long, unsigned long long);
 static int compare_domains(xenstat_domain **, xenstat_domain **);
@@ -212,10 +212,10 @@ int show_vbds = 0;
 int repeat_header = 0;
 int show_full_name = 0;
 #define PROMPT_VAL_LEN 80
-char *prompt = NULL;
+const char *prompt = NULL;
 char prompt_val[PROMPT_VAL_LEN];
 int prompt_val_len = 0;
-void (*prompt_complete_func)(char *);
+void (*prompt_complete_func)(const char *);
 
 static WINDOW *cwin;
 
@@ -331,7 +331,7 @@ static void attr_addstr(int attr, const char *str)
 }
 
 /* Handle setting the delay from the user-supplied value in prompt_val */
-static void set_delay(char *value)
+static void set_delay(const char *value)
 {
 	int new_delay;
 	new_delay = atoi(value);
@@ -341,7 +341,7 @@ static void set_delay(char *value)
 
 /* Enable prompting mode with the given prompt string; call the given function
  * when a value is available. */
-static void set_prompt(char *new_prompt, void (*func)(char *))
+static void set_prompt(const char *new_prompt, void (*func)(const char *))
 {
 	prompt = new_prompt;
 	prompt_val[0] = '\0';
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue May 18 14:00:46 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 18 May 2021 14:00:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.129234.242601 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lj0H8-0007EJ-PV; Tue, 18 May 2021 14:00:46 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 129234.242601; Tue, 18 May 2021 14:00:46 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lj0H8-0007EB-MT; Tue, 18 May 2021 14:00:46 +0000
Received: by outflank-mailman (input) for mailman id 129234;
 Tue, 18 May 2021 14:00:45 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lj0H7-0007E3-E4
 for xen-changelog@lists.xenproject.org; Tue, 18 May 2021 14:00:45 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lj0H7-00046x-DI
 for xen-changelog@lists.xenproject.org; Tue, 18 May 2021 14:00:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lj0H7-0001gb-CO
 for xen-changelog@lists.xenproject.org; Tue, 18 May 2021 14:00:45 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=MorknYrbsbSbUKDww/sgG+zJNr0mWmDwXYp8CBDA+Ks=; b=VbB7Czf1p5qGvo0sUKpAJlyU8v
	1Dm/8C34C6Ca9MqeAGolZ9m6xs/e5Yt9TmBFk5YwWVGxTl3TpSSLX/IYDue9ZXOgk5UyxeR9bLbvR
	0dVolLW0ty5stvI3oGeJZBSZuQwDGz/YoTfzSz4iIU0Gw2pbmYK0H2S1LXtgqjwbMwpA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/xenmon: xenbaked: Mark const the field text in stat_map_t
Message-Id: <E1lj0H7-0001gb-CO@xenbits.xenproject.org>
Date: Tue, 18 May 2021 14:00:45 +0000

commit 01d84420fb4a9be2ec474a7c1910bb22c28b53c8
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue May 18 14:51:48 2021 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Tue May 18 14:54:05 2021 +0100

    tools/xenmon: xenbaked: Mark const the field text in stat_map_t
    
    The field text in stat_map_t will point to string literals. So mark it
    as const to allow the compiler to catch any modified of the string.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
    Acked-by: Wei Liu <wl@xen.org>
---
 tools/xenmon/xenbaked.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/xenmon/xenbaked.c b/tools/xenmon/xenbaked.c
index d3f940a26b..1ed34334c8 100644
--- a/tools/xenmon/xenbaked.c
+++ b/tools/xenmon/xenbaked.c
@@ -182,7 +182,7 @@ typedef struct
 {
     int event_count;
     int event_id;
-    char *text;
+    const char *text;
 } stat_map_t;
 
 stat_map_t stat_map[] = {
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue May 18 18:11:07 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 18 May 2021 18:11:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.129567.243191 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lj4BM-0004FM-LK; Tue, 18 May 2021 18:11:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 129567.243191; Tue, 18 May 2021 18:11:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lj4BM-0004FE-I2; Tue, 18 May 2021 18:11:04 +0000
Received: by outflank-mailman (input) for mailman id 129567;
 Tue, 18 May 2021 18:11:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lj4BK-0004Eu-Ng
 for xen-changelog@lists.xenproject.org; Tue, 18 May 2021 18:11:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lj4BK-0000ck-M8
 for xen-changelog@lists.xenproject.org; Tue, 18 May 2021 18:11:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lj4BK-0004Jy-L3
 for xen-changelog@lists.xenproject.org; Tue, 18 May 2021 18:11:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=1qjI3KltWLtdkiHGS49lq1cfrdREnrcx2SfekUptzJM=; b=XK5DdKQeG9dT9/1AQ7ANxtd8n7
	gA4KWVBbNx4oQHfprPedooeDEWdt6QG9KddOE+4Qz0VwmJL6nBgyCegxd+fM/z80StYdA/MmoDoby
	MOmGPy2oYquhqEoLCiqw6zp5PjJX7ohZum1VG0KSIyZTJw66a3/be60OGN9m3Ij/5MDA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] build: centralize / unify asm-offsets generation
Message-Id: <E1lj4BK-0004Jy-L3@xenbits.xenproject.org>
Date: Tue, 18 May 2021 18:11:02 +0000

commit b6ecd5c8bc0b9727f095c0bb2fedf62a565417f1
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon May 17 15:38:39 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon May 17 15:38:39 2021 +0200

    build: centralize / unify asm-offsets generation
    
    Except for an additional prereq Arm and x86 have the same needs here,
    and Arm can also benefit from the recent x86 side improvement. Recurse
    into arch/*/ only for a phony include target (doing nothing on Arm),
    and handle asm-offsets itself entirely locally to xen/Makefile.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 .gitignore            |  2 +-
 xen/Makefile          | 10 +++++++---
 xen/arch/arm/Makefile |  6 +++---
 xen/arch/x86/Makefile |  7 +++----
 4 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/.gitignore b/.gitignore
index 1c2fa1530b..c27ea80802 100644
--- a/.gitignore
+++ b/.gitignore
@@ -318,13 +318,13 @@ xen/arch/x86/efi.lds
 xen/arch/x86/efi/check.efi
 xen/arch/x86/efi/mkreloc
 xen/arch/*/xen.lds
-xen/arch/*/asm-offsets.s
 xen/arch/*/efi/boot.c
 xen/arch/*/efi/compat.c
 xen/arch/*/efi/ebmalloc.c
 xen/arch/*/efi/efi.h
 xen/arch/*/efi/pe.c
 xen/arch/*/efi/runtime.c
+xen/asm-offsets.s
 xen/common/config_data.S
 xen/common/config.gz
 xen/include/headers*.chk
diff --git a/xen/Makefile b/xen/Makefile
index 9f3be7766d..7ce7692354 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -341,7 +341,7 @@ _clean: delete-unfresh-files
 	find . \( -name "*.o" -o -name ".*.d" -o -name ".*.d2" \
 		-o -name "*.gcno" -o -name ".*.cmd" \) -exec rm -f {} \;
 	rm -f include/asm $(TARGET) $(TARGET).gz $(TARGET).efi $(TARGET).efi.map $(TARGET)-syms $(TARGET)-syms.map *~ core
-	rm -f include/asm-*/asm-offsets.h
+	rm -f asm-offsets.s include/asm-*/asm-offsets.h
 	rm -f .banner
 
 .PHONY: _distclean
@@ -362,7 +362,7 @@ $(TARGET): delete-unfresh-files
 		done; \
 		true
 	$(MAKE) -f $(BASEDIR)/Rules.mk -C include
-	$(MAKE) -f $(BASEDIR)/Rules.mk -C arch/$(TARGET_ARCH) asm-offsets.s
+	$(MAKE) -f $(BASEDIR)/Rules.mk -C arch/$(TARGET_ARCH) include
 	$(MAKE) -f $(BASEDIR)/Rules.mk include/asm-$(TARGET_ARCH)/asm-offsets.h
 	$(MAKE) -f $(BASEDIR)/Rules.mk -C arch/$(TARGET_ARCH) $@
 
@@ -399,7 +399,11 @@ include/xen/compile.h: include/xen/compile.h.in .banner
 	@sed -rf tools/process-banner.sed < .banner >> $@.new
 	@mv -f $@.new $@
 
-include/asm-$(TARGET_ARCH)/asm-offsets.h: arch/$(TARGET_ARCH)/asm-offsets.s
+asm-offsets.s: arch/$(TARGET_ARCH)/$(TARGET_SUBARCH)/asm-offsets.c
+	$(CC) $(filter-out -Wa$(comma)% -flto,$(c_flags)) -S -g0 -o $@.new -MQ $@ $<
+	$(call move-if-changed,$@.new,$@)
+
+include/asm-$(TARGET_ARCH)/asm-offsets.h: asm-offsets.s
 	@(set -e; \
 	  echo "/*"; \
 	  echo " * DO NOT MODIFY."; \
diff --git a/xen/arch/arm/Makefile b/xen/arch/arm/Makefile
index ca75f1040d..3d3b97b5b4 100644
--- a/xen/arch/arm/Makefile
+++ b/xen/arch/arm/Makefile
@@ -130,8 +130,8 @@ $(TARGET)-syms: prelink.o xen.lds
 		>$(@D)/$(@F).map
 	rm -f $(@D)/.$(@F).[0-9]*
 
-asm-offsets.s: $(TARGET_SUBARCH)/asm-offsets.c
-	$(CC) $(filter-out -flto,$(c_flags)) -S -o $@ $<
+.PHONY: include
+include:
 
 xen.lds: xen.lds.S
 	$(CPP) -P $(a_flags) -D__LINKER__ -MQ $@ -o $@ $<
@@ -140,6 +140,6 @@ dtb.o: $(patsubst "%",%,$(CONFIG_DTB_FILE))
 
 .PHONY: clean
 clean::
-	rm -f asm-offsets.s xen.lds
+	rm -f xen.lds
 	rm -f $(BASEDIR)/.xen-syms.[0-9]*
 	rm -f $(TARGET).efi
diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile
index ada085d17a..1f5887afc4 100644
--- a/xen/arch/x86/Makefile
+++ b/xen/arch/x86/Makefile
@@ -272,9 +272,8 @@ endif
 efi/buildid.o efi/relocs-dummy.o: $(BASEDIR)/arch/x86/efi/built_in.o
 efi/buildid.o efi/relocs-dummy.o: ;
 
-asm-offsets.s: $(TARGET_SUBARCH)/asm-offsets.c $(BASEDIR)/include/asm-x86/asm-macros.h
-	$(CC) $(filter-out -Wa$(comma)% -flto,$(c_flags)) -S -g0 -o $@.new -MQ $@ $<
-	$(call move-if-changed,$@.new,$@)
+.PHONY: include
+include: $(BASEDIR)/include/asm-x86/asm-macros.h
 
 asm-macros.i: CFLAGS-y += -D__ASSEMBLY__ -P
 
@@ -304,7 +303,7 @@ efi/mkreloc: efi/mkreloc.c
 
 .PHONY: clean
 clean::
-	rm -f asm-offsets.s *.lds *.new boot/*.o boot/*~ boot/core boot/mkelf32
+	rm -f *.lds *.new boot/*.o boot/*~ boot/core boot/mkelf32
 	rm -f asm-macros.i $(BASEDIR)/include/asm-x86/asm-macros.*
 	rm -f $(BASEDIR)/.xen-syms.[0-9]* boot/.*.d $(BASEDIR)/.xen.elf32
 	rm -f $(BASEDIR)/.xen.efi.[0-9]* efi/*.efi efi/mkreloc
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue May 18 18:11:14 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 18 May 2021 18:11:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.129568.243195 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lj4BW-0004IL-Mg; Tue, 18 May 2021 18:11:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 129568.243195; Tue, 18 May 2021 18:11:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lj4BW-0004IC-Jb; Tue, 18 May 2021 18:11:14 +0000
Received: by outflank-mailman (input) for mailman id 129568;
 Tue, 18 May 2021 18:11:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lj4BU-0004Hp-Q1
 for xen-changelog@lists.xenproject.org; Tue, 18 May 2021 18:11:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lj4BU-0000ct-PB
 for xen-changelog@lists.xenproject.org; Tue, 18 May 2021 18:11:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lj4BU-0004Ku-OL
 for xen-changelog@lists.xenproject.org; Tue, 18 May 2021 18:11:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=7cgBu2rJLHK54vuUazdj1peitgyuRLIMfuCKa9UOhGo=; b=sGLAC5Z49gfv5JiGxqg8s5R5ce
	J4IohXMuIZ4VUS1BFHAwqSRHMq+L6TBXPUn2kPkjLKNXFjsMz5ZmSp0j6PJ8KpnMsAfyH1th0ZzM8
	dbQ5FjgNRhpNxT+zNUrX17legZOWRwtcWUc4zFqfX62Ct9lZumrF1Tppam5G1yPN2c8E=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/AMD: also determine L3 cache size
Message-Id: <E1lj4BU-0004Ku-OL@xenbits.xenproject.org>
Date: Tue, 18 May 2021 18:11:12 +0000

commit 12a963b22b02a377ddb6a46db304fa4a0eee8c39
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon May 17 15:40:53 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon May 17 15:40:53 2021 +0200

    x86/AMD: also determine L3 cache size
    
    For Intel CPUs we record L3 cache size, hence we should also do so for
    AMD and alike.
    
    While making these additions, also make sure (throughout the function)
    that we don't needlessly overwrite prior values when the new value to be
    stored is zero.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/cpu/common.c | 39 ++++++++++++++++++++++++++-------------
 1 file changed, 26 insertions(+), 13 deletions(-)

diff --git a/xen/arch/x86/cpu/common.c b/xen/arch/x86/cpu/common.c
index 0eb364f8a6..302f7f35d8 100644
--- a/xen/arch/x86/cpu/common.c
+++ b/xen/arch/x86/cpu/common.c
@@ -240,28 +240,41 @@ int get_model_name(struct cpuinfo_x86 *c)
 
 void display_cacheinfo(struct cpuinfo_x86 *c)
 {
-	unsigned int dummy, ecx, edx, l2size;
+	unsigned int dummy, ecx, edx, size;
 
 	if (c->extended_cpuid_level >= 0x80000005) {
 		cpuid(0x80000005, &dummy, &dummy, &ecx, &edx);
-		if (opt_cpu_info)
-			printk("CPU: L1 I cache %dK (%d bytes/line),"
-			              " D cache %dK (%d bytes/line)\n",
-			       edx>>24, edx&0xFF, ecx>>24, ecx&0xFF);
-		c->x86_cache_size=(ecx>>24)+(edx>>24);	
+		if ((edx | ecx) >> 24) {
+			if (opt_cpu_info)
+				printk("CPU: L1 I cache %uK (%u bytes/line),"
+				              " D cache %uK (%u bytes/line)\n",
+				       edx >> 24, edx & 0xFF, ecx >> 24, ecx & 0xFF);
+			c->x86_cache_size = (ecx >> 24) + (edx >> 24);
+		}
 	}
 
 	if (c->extended_cpuid_level < 0x80000006)	/* Some chips just has a large L1. */
 		return;
 
-	ecx = cpuid_ecx(0x80000006);
-	l2size = ecx >> 16;
-	
-	c->x86_cache_size = l2size;
+	cpuid(0x80000006, &dummy, &dummy, &ecx, &edx);
 
-	if (opt_cpu_info)
-		printk("CPU: L2 Cache: %dK (%d bytes/line)\n",
-		       l2size, ecx & 0xFF);
+	size = ecx >> 16;
+	if (size) {
+		c->x86_cache_size = size;
+
+		if (opt_cpu_info)
+			printk("CPU: L2 Cache: %uK (%u bytes/line)\n",
+			       size, ecx & 0xFF);
+	}
+
+	size = edx >> 18;
+	if (size) {
+		c->x86_cache_size = size * 512;
+
+		if (opt_cpu_info)
+			printk("CPU: L3 Cache: %uM (%u bytes/line)\n",
+			       (size + (size & 1)) >> 1, edx & 0xFF);
+	}
 }
 
 static inline u32 _phys_pkg_id(u32 cpuid_apic, int index_msb)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue May 18 18:11:24 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 18 May 2021 18:11:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.129569.243199 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lj4Bg-0004My-OI; Tue, 18 May 2021 18:11:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 129569.243199; Tue, 18 May 2021 18:11:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lj4Bg-0004Mq-LD; Tue, 18 May 2021 18:11:24 +0000
Received: by outflank-mailman (input) for mailman id 129569;
 Tue, 18 May 2021 18:11:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lj4Be-0004MQ-T0
 for xen-changelog@lists.xenproject.org; Tue, 18 May 2021 18:11:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lj4Be-0000dR-SB
 for xen-changelog@lists.xenproject.org; Tue, 18 May 2021 18:11:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lj4Be-0004Li-RH
 for xen-changelog@lists.xenproject.org; Tue, 18 May 2021 18:11:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=QQbZwbyBcdBQNma11goDhIOzxOxT4irm8ob7fpVxodc=; b=bM8LBq1s22sYJgwLM95uj396TX
	pQ8SnWefPuKiw6Hr4PIvt5w5lA4F5YJ6YulEBwxTBjR8CwsxIjdaoUwtdJrUrdUHJVL/ken1IekBO
	5VQHbA6dvbXbeIH9R/nTxAF8+ZbYZOHybQozhl4asI9wilE/SuocQBZPO0F/Tp1nAyrw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86emul: fix test harness build for gas 2.36
Message-Id: <E1lj4Be-0004Li-RH@xenbits.xenproject.org>
Date: Tue, 18 May 2021 18:11:22 +0000

commit aa803ba38a867551917d11059eaa044955556e05
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon May 17 15:41:28 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon May 17 15:41:28 2021 +0200

    x86emul: fix test harness build for gas 2.36
    
    All of the sudden, besides .text and .rodata and alike, an always
    present .note.gnu.property section has appeared. This section, when
    converting to binary format output, gets placed according to its
    linked address, causing the resulting blobs to be about 128Mb in size.
    The resulting headers with a C representation of the binary blobs then
    are, of course all a multiple of that size (and take accordingly long
    to create). I didn't bother waiting to see what size the final
    test_x86_emulator binary then would have had.
    
    See also https://sourceware.org/bugzilla/show_bug.cgi?id=27753.
    
    Rather than figuring out whether gas supports -mx86-used-note=, simply
    remove the section while creating *.bin.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
---
 tools/tests/x86_emulator/testcase.mk | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/tests/x86_emulator/testcase.mk b/tools/tests/x86_emulator/testcase.mk
index dafeb6caf7..d4aa82e3f3 100644
--- a/tools/tests/x86_emulator/testcase.mk
+++ b/tools/tests/x86_emulator/testcase.mk
@@ -12,11 +12,11 @@ all: $(TESTCASE).bin
 %.bin: %.c
 	$(CC) $(filter-out -M% .%,$(CFLAGS)) -c $<
 	$(LD) $(LDFLAGS_DIRECT) -N -Ttext 0x100000 -o $*.tmp $*.o
-	$(OBJCOPY) -O binary $*.tmp $@
+	$(OBJCOPY) -O binary -R .note.gnu.property $*.tmp $@
 	rm -f $*.tmp
 
 %-opmask.bin: opmask.S
 	$(CC) $(filter-out -M% .%,$(CFLAGS)) -c $< -o $(basename $@).o
 	$(LD) $(LDFLAGS_DIRECT) -N -Ttext 0x100000 -o $(basename $@).tmp $(basename $@).o
-	$(OBJCOPY) -O binary $(basename $@).tmp $@
+	$(OBJCOPY) -O binary -R .note.gnu.property $(basename $@).tmp $@
 	rm -f $(basename $@).tmp
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue May 18 18:11:34 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 18 May 2021 18:11:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.129570.243203 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lj4Bq-0004Qk-QP; Tue, 18 May 2021 18:11:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 129570.243203; Tue, 18 May 2021 18:11:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lj4Bq-0004Qc-Ml; Tue, 18 May 2021 18:11:34 +0000
Received: by outflank-mailman (input) for mailman id 129570;
 Tue, 18 May 2021 18:11:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lj4Bp-0004Q4-0D
 for xen-changelog@lists.xenproject.org; Tue, 18 May 2021 18:11:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lj4Bo-0000dr-Vc
 for xen-changelog@lists.xenproject.org; Tue, 18 May 2021 18:11:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lj4Bo-0004MO-UO
 for xen-changelog@lists.xenproject.org; Tue, 18 May 2021 18:11:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=aEf1gMAzSmzmWIZGhy4Tbxcq6zFM1P79Z+YQIMzGa5g=; b=wxdr4LON3OWo0pggrnqwNSipV4
	7kO4u2T2XD73ufr+8UPcFIdePESk9u7ML3hhO5ohcS2gNTkJJEGRn7quw+RGUL1ESHlVjaTeJd2jZ
	MfiFyMkNWZQl2cMyhCxd4cUuHVoQVrKpkIzdoTR091QAOvTkDofm3Vu3wWhBccA9BG3M=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/shim: fix build when !PV32
Message-Id: <E1lj4Bo-0004MO-UO@xenbits.xenproject.org>
Date: Tue, 18 May 2021 18:11:32 +0000

commit bd1e7b47bac00735a47055e2cba4106b54175138
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon May 17 15:42:00 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon May 17 15:42:00 2021 +0200

    x86/shim: fix build when !PV32
    
    In this case compat headers don't get generated (and aren't needed).
    The changes made by 527922008bce ("x86: slim down hypercall handling
    when !PV32") also weren't quite sufficient for this case.
    
    Try to limit #ifdef-ary by introducing two "fallback" #define-s.
    
    Fixes: d23d792478db ("x86: avoid building COMPAT code when !HVM && !PV32")
    Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/pv/shim.c | 23 +++++++++++++++++++----
 1 file changed, 19 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/pv/shim.c b/xen/arch/x86/pv/shim.c
index 4c6f442274..8164a0fbde 100644
--- a/xen/arch/x86/pv/shim.c
+++ b/xen/arch/x86/pv/shim.c
@@ -34,8 +34,6 @@
 #include <public/arch-x86/cpuid.h>
 #include <public/hvm/params.h>
 
-#include <compat/grant_table.h>
-
 #undef virt_to_mfn
 #define virt_to_mfn(va) _mfn(__virt_to_mfn(va))
 
@@ -300,8 +298,10 @@ static void write_start_info(struct domain *d)
                                           &si->console.domU.mfn) )
         BUG();
 
+#ifdef CONFIG_PV32
     if ( compat )
         xlat_start_info(si, XLAT_start_info_console_domU);
+#endif
 
     unmap_domain_page(si);
 }
@@ -675,6 +675,13 @@ void pv_shim_inject_evtchn(unsigned int port)
     }
 }
 
+#ifdef CONFIG_PV32
+# include <compat/grant_table.h>
+#else
+# define compat_gnttab_setup_table gnttab_setup_table
+# define compat_handle_okay guest_handle_okay
+#endif
+
 static long pv_shim_grant_table_op(unsigned int cmd,
                                    XEN_GUEST_HANDLE_PARAM(void) uop,
                                    unsigned int count)
@@ -704,10 +711,13 @@ static long pv_shim_grant_table_op(unsigned int cmd,
             rc = -EFAULT;
             break;
         }
+
+#ifdef CONFIG_PV32
         if ( compat )
 #define XLAT_gnttab_setup_table_HNDL_frame_list(d, s)
             XLAT_gnttab_setup_table(&nat, &cmp);
 #undef XLAT_gnttab_setup_table_HNDL_frame_list
+#endif
 
         nat.status = GNTST_okay;
 
@@ -778,6 +788,7 @@ static long pv_shim_grant_table_op(unsigned int cmd,
             }
 
             ASSERT(grant_frames[i]);
+#ifdef CONFIG_PV32
             if ( compat )
             {
                 compat_pfn_t pfn = grant_frames[i];
@@ -789,8 +800,10 @@ static long pv_shim_grant_table_op(unsigned int cmd,
                     break;
                 }
             }
-            else if ( __copy_to_guest_offset(nat.frame_list, i,
-                                             &grant_frames[i], 1) )
+            else
+#endif
+            if ( __copy_to_guest_offset(nat.frame_list, i,
+                                        &grant_frames[i], 1) )
             {
                 nat.status = GNTST_bad_virt_addr;
                 rc = -EFAULT;
@@ -799,10 +812,12 @@ static long pv_shim_grant_table_op(unsigned int cmd,
         }
         spin_unlock(&grant_lock);
 
+#ifdef CONFIG_PV32
         if ( compat )
 #define XLAT_gnttab_setup_table_HNDL_frame_list(d, s)
             XLAT_gnttab_setup_table(&cmp, &nat);
 #undef XLAT_gnttab_setup_table_HNDL_frame_list
+#endif
 
         if ( unlikely(compat ? __copy_to_guest(uop, &cmp, 1)
                              : __copy_to_guest(uop, &nat, 1)) )
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue May 18 18:11:45 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 18 May 2021 18:11:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.129573.243208 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lj4C0-0004VX-UQ; Tue, 18 May 2021 18:11:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 129573.243208; Tue, 18 May 2021 18:11:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lj4C0-0004VP-Pf; Tue, 18 May 2021 18:11:44 +0000
Received: by outflank-mailman (input) for mailman id 129573;
 Tue, 18 May 2021 18:11:43 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lj4Bz-0004Ul-43
 for xen-changelog@lists.xenproject.org; Tue, 18 May 2021 18:11:43 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lj4Bz-0000e5-2P
 for xen-changelog@lists.xenproject.org; Tue, 18 May 2021 18:11:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lj4Bz-0004NF-1W
 for xen-changelog@lists.xenproject.org; Tue, 18 May 2021 18:11:43 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=20cxll9laFtmqcLje90JS+PPRODq1h3VbE6Qul8VQC0=; b=fZ6GbBh+hhNjTeXiLiAdFvXUfr
	gEeXKftMRcRWHWJZ7oh7B63+M+i5CCik4l2sB0i57fKlSJDMjJ1DQ2CkAGvsWKSX99CSN+L5DgAT2
	3VdJ/g9Tz/LvRa4eNsI4mypAkrS239AePLQ10Zw9xhLgZgPHn1k/BLbIPF0PxkoRA/2g=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] Argo/XSM: add SILO hooks
Message-Id: <E1lj4Bz-0004NF-1W@xenbits.xenproject.org>
Date: Tue, 18 May 2021 18:11:43 +0000

commit 599bca58849effbac4ef03a5986d20e38e26a854
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon May 17 15:42:32 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon May 17 15:42:32 2021 +0200

    Argo/XSM: add SILO hooks
    
    In SILO mode restrictions for inter-domain communication should apply
    here along the lines of those for evtchn and gnttab.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Daniel P. Smith <dpsmith@apertussolutions.com>
---
 xen/xsm/silo.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/xen/xsm/silo.c b/xen/xsm/silo.c
index 4850756a3d..fc2ca5cd2d 100644
--- a/xen/xsm/silo.c
+++ b/xen/xsm/silo.c
@@ -81,12 +81,35 @@ static int silo_grant_copy(struct domain *d1, struct domain *d2)
     return -EPERM;
 }
 
+#ifdef CONFIG_ARGO
+
+static int silo_argo_register_single_source(const struct domain *d1,
+                                            const struct domain *d2)
+{
+    if ( silo_mode_dom_check(d1, d2) )
+        return xsm_argo_register_single_source(d1, d2);
+    return -EPERM;
+}
+
+static int silo_argo_send(const struct domain *d1, const struct domain *d2)
+{
+    if ( silo_mode_dom_check(d1, d2) )
+        return xsm_argo_send(d1, d2);
+    return -EPERM;
+}
+
+#endif
+
 static struct xsm_operations silo_xsm_ops = {
     .evtchn_unbound = silo_evtchn_unbound,
     .evtchn_interdomain = silo_evtchn_interdomain,
     .grant_mapref = silo_grant_mapref,
     .grant_transfer = silo_grant_transfer,
     .grant_copy = silo_grant_copy,
+#ifdef CONFIG_ARGO
+    .argo_register_single_source = silo_argo_register_single_source,
+    .argo_send = silo_argo_send,
+#endif
 };
 
 void __init silo_init(void)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue May 18 18:11:54 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 18 May 2021 18:11:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.129576.243222 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lj4CA-0004tY-7R; Tue, 18 May 2021 18:11:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 129576.243222; Tue, 18 May 2021 18:11:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lj4CA-0004tO-3w; Tue, 18 May 2021 18:11:54 +0000
Received: by outflank-mailman (input) for mailman id 129576;
 Tue, 18 May 2021 18:11:53 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lj4C9-0004sj-6G
 for xen-changelog@lists.xenproject.org; Tue, 18 May 2021 18:11:53 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lj4C9-0000eN-5N
 for xen-changelog@lists.xenproject.org; Tue, 18 May 2021 18:11:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lj4C9-0004O9-4Y
 for xen-changelog@lists.xenproject.org; Tue, 18 May 2021 18:11:53 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=5vPKnQkKjrBo9M74JxZHGDv/C+1rktnATrdjFCuB5RY=; b=NYJdnlM7WASCGhcP3EjV9TViB3
	LfFfd4oIPRcWa0HuxQgQHc/qPRyTtPazMza90rT7DqX3dUxU1HOeqSjl+1a0WRBwX397mkU5ppwp7
	Jp3gU33j7NENUnsbOG+0KMemPzGgNB3nu8GV3fj6AT3x5CxIzM6bEqadSbhJm/EKJ5lA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] include/public: add RING_RESPONSE_PROD_OVERFLOW macro
Message-Id: <E1lj4C9-0004O9-4Y@xenbits.xenproject.org>
Date: Tue, 18 May 2021 18:11:53 +0000

commit d1f6296053f464c9da6f6fa5f1ece864130718ce
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Mon May 17 15:43:04 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon May 17 15:43:04 2021 +0200

    include/public: add RING_RESPONSE_PROD_OVERFLOW macro
    
    Add a new RING_RESPONSE_PROD_OVERFLOW() macro for being able to
    detect an ill-behaved backend tampering with the response producer
    index.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/include/public/io/ring.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/xen/include/public/io/ring.h b/xen/include/public/io/ring.h
index 0b08b2697e..c486c457e0 100644
--- a/xen/include/public/io/ring.h
+++ b/xen/include/public/io/ring.h
@@ -259,6 +259,10 @@ typedef struct __name##_back_ring __name##_back_ring_t
 #define RING_REQUEST_PROD_OVERFLOW(_r, _prod)                           \
     (((_prod) - (_r)->rsp_prod_pvt) > RING_SIZE(_r))
 
+/* Ill-behaved backend determination: Can there be this many responses? */
+#define RING_RESPONSE_PROD_OVERFLOW(_r, _prod)                          \
+    (((_prod) - (_r)->rsp_cons) > RING_SIZE(_r))
+
 #define RING_PUSH_REQUESTS(_r) do {                                     \
     xen_wmb(); /* back sees requests /before/ updated producer index */ \
     (_r)->sring->req_prod = (_r)->req_prod_pvt;                         \
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue May 18 18:12:04 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 18 May 2021 18:12:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.129581.243229 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lj4CK-00058Q-9x; Tue, 18 May 2021 18:12:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 129581.243229; Tue, 18 May 2021 18:12:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lj4CK-00058H-6z; Tue, 18 May 2021 18:12:04 +0000
Received: by outflank-mailman (input) for mailman id 129581;
 Tue, 18 May 2021 18:12:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lj4CJ-00057x-9L
 for xen-changelog@lists.xenproject.org; Tue, 18 May 2021 18:12:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lj4CJ-0000eo-8S
 for xen-changelog@lists.xenproject.org; Tue, 18 May 2021 18:12:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lj4CJ-0004PI-7Y
 for xen-changelog@lists.xenproject.org; Tue, 18 May 2021 18:12:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=T228B3Urw4LDpACv8YOqblRln2atijB+fsH6otHXvRU=; b=5i62TxveAqZ8KTh4/i1Sn9qHQJ
	DYw44f/zmuJZGxzBrHz3QxqoElpUv1w3vUGl9vuVTkr62g/v+K7nlaSJqs7qqg1qDUtJEZYSYl3OD
	eLUpa4oawOKwjR12lWUTDFC78m7OuU6i08qH5Vi8NT4ULYeW1FSQ8q7Y3AEAADXJDnk4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen: fix build when !CONFIG_GRANT_TABLE
Message-Id: <E1lj4CJ-0004PI-7Y@xenbits.xenproject.org>
Date: Tue, 18 May 2021 18:12:03 +0000

commit 71a25d03b70b399d666d05a3d0046d821248c80e
Author:     Connor Davis <connojdavis@gmail.com>
AuthorDate: Mon May 17 15:43:19 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon May 17 15:43:19 2021 +0200

    xen: fix build when !CONFIG_GRANT_TABLE
    
    Move struct grant_table; in grant_table.h above
    ifdef CONFIG_GRANT_TABLE. This fixes the following:
    
    /build/xen/include/xen/grant_table.h:84:50: error: 'struct grant_table'
    declared inside parameter list will not be visible outside of this
    definition or declaration [-Werror]
       84 | static inline int mem_sharing_gref_to_gfn(struct grant_table *gt,
          |
    
    Signed-off-by: Connor Davis <connojdavis@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/include/xen/grant_table.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/include/xen/grant_table.h b/xen/include/xen/grant_table.h
index 63b6dc78f4..9f8b7e66c1 100644
--- a/xen/include/xen/grant_table.h
+++ b/xen/include/xen/grant_table.h
@@ -28,9 +28,10 @@
 #include <public/grant_table.h>
 #include <asm/grant_table.h>
 
-#ifdef CONFIG_GRANT_TABLE
 struct grant_table;
 
+#ifdef CONFIG_GRANT_TABLE
+
 extern unsigned int opt_max_grant_frames;
 
 /* Create/destroy per-domain grant table context. */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue May 18 18:12:14 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 18 May 2021 18:12:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.129584.243232 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lj4CU-0005F8-Bl; Tue, 18 May 2021 18:12:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 129584.243232; Tue, 18 May 2021 18:12:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lj4CU-0005F0-8W; Tue, 18 May 2021 18:12:14 +0000
Received: by outflank-mailman (input) for mailman id 129584;
 Tue, 18 May 2021 18:12:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lj4CT-0005Em-CN
 for xen-changelog@lists.xenproject.org; Tue, 18 May 2021 18:12:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lj4CT-0000f2-BV
 for xen-changelog@lists.xenproject.org; Tue, 18 May 2021 18:12:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lj4CT-0004Px-Ag
 for xen-changelog@lists.xenproject.org; Tue, 18 May 2021 18:12:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=OwDrUwPXOoGI/MW+e2JnYaVduROBSpMvSb6SjDX1c1U=; b=nkA6Lp0nXS5Uhr+6qpaUTr5goM
	ACEliUs+Br3Z2xpTgfsaNfTUbKyHAYChbJXoZ8SAbAzqDY5fyTuBD5kYc6xzmHAnHRS9+gAgZFJYC
	vlBz/PbuYWhF6E7kHAOhtt22znrHU3Pbt+tIzvg8hEq5SQbeZgpzqL3a8wwuVuIGhW2s=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: kernel: Propagate the error if we fail to decompress the kernel
Message-Id: <E1lj4CT-0004Px-Ag@xenbits.xenproject.org>
Date: Tue, 18 May 2021 18:12:13 +0000

commit 27eb6833134d0f3ddfb02d09055776e837e9a747
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Apr 6 20:15:54 2021 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Mon May 17 17:09:40 2021 +0100

    xen/arm: kernel: Propagate the error if we fail to decompress the kernel
    
    Currently, we are ignoring any error from perform_gunzip() and replacing
    the compressed kernel with the "uncompressed" kernel.
    
    If there is a gzip failure, then it means that the output buffer may
    contain garbagge. So it can result to various sort of behavior that may
    be difficult to root cause.
    
    In case of failure, free the output buffer and propagate the error.
    We also need to adjust the return check for kernel_compress() as
    perform_gunzip() may return a positive value.
    
    Take the opportunity to adjust the code style for the check.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Michal Orzel <michal.orzel@arm.com>
---
 xen/arch/arm/kernel.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/kernel.c b/xen/arch/arm/kernel.c
index ab78689ed2..8f43caa186 100644
--- a/xen/arch/arm/kernel.c
+++ b/xen/arch/arm/kernel.c
@@ -292,6 +292,12 @@ static __init int kernel_decompress(struct bootmodule *mod)
     iounmap(input);
     vunmap(output);
 
+    if ( rc )
+    {
+        free_domheap_pages(pages, kernel_order_out);
+        return rc;
+    }
+
     mod->start = page_to_maddr(pages);
     mod->size = output_size;
 
@@ -503,7 +509,7 @@ int __init kernel_probe(struct kernel_info *info,
 
     /* if it is a gzip'ed image, 32bit or 64bit, uncompress it */
     rc = kernel_decompress(mod);
-    if (rc < 0 && rc != -EINVAL)
+    if ( rc && rc != -EINVAL )
         return rc;
 
 #ifdef CONFIG_ARM_64
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue May 18 18:12:24 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 18 May 2021 18:12:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.129587.243239 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lj4Ce-0005JX-Ds; Tue, 18 May 2021 18:12:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 129587.243239; Tue, 18 May 2021 18:12:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lj4Ce-0005JI-A3; Tue, 18 May 2021 18:12:24 +0000
Received: by outflank-mailman (input) for mailman id 129587;
 Tue, 18 May 2021 18:12:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lj4Cd-0005J4-F0
 for xen-changelog@lists.xenproject.org; Tue, 18 May 2021 18:12:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lj4Cd-0000fU-EI
 for xen-changelog@lists.xenproject.org; Tue, 18 May 2021 18:12:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lj4Cd-0004Qt-Dh
 for xen-changelog@lists.xenproject.org; Tue, 18 May 2021 18:12:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=hgkdGrKhTu6kcOYvj8h3xYgoxMHY/G93Vfd10XgDzXY=; b=RqIEwGmCuJ3DEWhxX3JXaIsi3l
	SliGp/e6/aRNgdOxDYjZhn0BqNke/B3yZegyFzi6hDCv6/5XIG3z6P/Neq/IdF7QO6eqGHGsnnRgj
	tCjQ8tX1yqivupMeWlaxYTXjamV0HhCulwy8g2jgnp77iubXh+ozAOhAu9inKMg3v5ao=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/xenstore: cleanup Makefile and gitignore
Message-Id: <E1lj4Cd-0004Qt-Dh@xenbits.xenproject.org>
Date: Tue, 18 May 2021 18:12:23 +0000

commit 3ac8835a80b27fc4e7116dbde78d3eececc66fc9
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Fri May 14 11:01:16 2021 +0200
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Mon May 17 18:56:43 2021 +0100

    tools/xenstore: cleanup Makefile and gitignore
    
    The Makefile of xenstore and related to that the global .gitignore
    file contain some leftovers from ancient times. Remove those.
    
    While at it sort the tools/xenstore/* entries in .gitignore.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 .gitignore              | 7 +++----
 tools/xenstore/Makefile | 2 +-
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/.gitignore b/.gitignore
index c27ea80802..38a085e398 100644
--- a/.gitignore
+++ b/.gitignore
@@ -288,15 +288,15 @@ tools/xenpaging/xenpaging
 tools/xenpmd/xenpmd
 tools/xenstore/xenstore
 tools/xenstore/xenstore-chmod
+tools/xenstore/xenstore-control
 tools/xenstore/xenstore-exists
 tools/xenstore/xenstore-list
+tools/xenstore/xenstore-ls
 tools/xenstore/xenstore-read
 tools/xenstore/xenstore-rm
+tools/xenstore/xenstore-watch
 tools/xenstore/xenstore-write
-tools/xenstore/xenstore-control
-tools/xenstore/xenstore-ls
 tools/xenstore/xenstored
-tools/xenstore/xenstored_test
 tools/xenstore/xs_tdb_dump
 tools/xentop/xentop
 tools/xentrace/xentrace_setsize
@@ -428,7 +428,6 @@ tools/firmware/etherboot/ipxe.tar.gz
 tools/firmware/etherboot/ipxe/
 tools/python/xen/lowlevel/xl/_pyxl_types.c
 tools/python/xen/lowlevel/xl/_pyxl_types.h
-tools/xenstore/xenstore-watch
 tools/xl/_paths.h
 tools/xl/xl
 
diff --git a/tools/xenstore/Makefile b/tools/xenstore/Makefile
index ab89e22d3a..8ced12c27e 100644
--- a/tools/xenstore/Makefile
+++ b/tools/xenstore/Makefile
@@ -90,7 +90,7 @@ xs_tdb_dump: xs_tdb_dump.o utils.o tdb.o talloc.o
 .PHONY: clean
 clean:
 	rm -f *.a *.o xenstored_probes.h
-	rm -f xenstored xs_random xs_stress xs_crashme
+	rm -f xenstored
 	rm -f xs_tdb_dump xenstore-control init-xenstore-domain
 	rm -f xenstore $(CLIENTS)
 	$(RM) $(DEPS_RM)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed May 19 05:11:09 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 19 May 2021 05:11:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.129831.243488 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ljEU3-0002KX-9m; Wed, 19 May 2021 05:11:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 129831.243488; Wed, 19 May 2021 05:11:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ljEU3-0002KM-6T; Wed, 19 May 2021 05:11:03 +0000
Received: by outflank-mailman (input) for mailman id 129831;
 Wed, 19 May 2021 05:11:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ljEU2-0002Jz-4x
 for xen-changelog@lists.xenproject.org; Wed, 19 May 2021 05:11:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ljEU2-0001ir-2W
 for xen-changelog@lists.xenproject.org; Wed, 19 May 2021 05:11:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ljEU2-0007eJ-1a
 for xen-changelog@lists.xenproject.org; Wed, 19 May 2021 05:11:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=46R7EGN6cI+O1pBOeVZ3YxWdn/+C1Zeq0ZkzupcveDk=; b=ZNPFS5kqJgz5TLYwZp8WKz2Yt2
	F/LmEuTPOOubEw/ewHvblBscHW6PBF2dylEcKfK70ZeHpUwlPMcWhCcZjPpb2vatkvNnhL/zePMYy
	5i9Qsf6sMuBfwKYi3nNoHwJvp0a/XWR7L5XWvSk540WgvWi5ZaBfSjyiwAGPjMVl32Cw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/xenstore: move per connection read and write func hooks into a struct
Message-Id: <E1ljEU2-0007eJ-1a@xenbits.xenproject.org>
Date: Wed, 19 May 2021 05:11:02 +0000

commit 8b9890e1c0f5b35c199f40eb4e6cd0ce6c34829b
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Tue May 18 08:19:06 2021 +0200
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Tue May 18 13:51:23 2021 +0100

    tools/xenstore: move per connection read and write func hooks into a struct
    
    Put the interface type specific functions into an own structure and let
    struct connection contain only a pointer to that new function vector.
    
    Don't even define the socket based functions in case of NO_SOCKETS
    (Mini-OS).
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
---
 tools/xenstore/xenstored_core.c   | 44 ++++++++++++++++-----------------------
 tools/xenstore/xenstored_core.h   | 21 ++++++++++---------
 tools/xenstore/xenstored_domain.c | 13 ++++++++++--
 3 files changed, 40 insertions(+), 38 deletions(-)

diff --git a/tools/xenstore/xenstored_core.c b/tools/xenstore/xenstored_core.c
index 02ae390e25..340654855a 100644
--- a/tools/xenstore/xenstored_core.c
+++ b/tools/xenstore/xenstored_core.c
@@ -226,8 +226,8 @@ static bool write_messages(struct connection *conn)
 				sockmsg_string(out->hdr.msg.type),
 				out->hdr.msg.len,
 				out->buffer, conn);
-		ret = conn->write(conn, out->hdr.raw + out->used,
-				  sizeof(out->hdr) - out->used);
+		ret = conn->funcs->write(conn, out->hdr.raw + out->used,
+					 sizeof(out->hdr) - out->used);
 		if (ret < 0)
 			return false;
 
@@ -243,8 +243,8 @@ static bool write_messages(struct connection *conn)
 			return true;
 	}
 
-	ret = conn->write(conn, out->buffer + out->used,
-			  out->hdr.msg.len - out->used);
+	ret = conn->funcs->write(conn, out->buffer + out->used,
+				 out->hdr.msg.len - out->used);
 	if (ret < 0)
 		return false;
 
@@ -1532,8 +1532,8 @@ static void handle_input(struct connection *conn)
 	/* Not finished header yet? */
 	if (in->inhdr) {
 		if (in->used != sizeof(in->hdr)) {
-			bytes = conn->read(conn, in->hdr.raw + in->used,
-					   sizeof(in->hdr) - in->used);
+			bytes = conn->funcs->read(conn, in->hdr.raw + in->used,
+						  sizeof(in->hdr) - in->used);
 			if (bytes < 0)
 				goto bad_client;
 			in->used += bytes;
@@ -1558,8 +1558,8 @@ static void handle_input(struct connection *conn)
 		in->inhdr = false;
 	}
 
-	bytes = conn->read(conn, in->buffer + in->used,
-			   in->hdr.msg.len - in->used);
+	bytes = conn->funcs->read(conn, in->buffer + in->used,
+				  in->hdr.msg.len - in->used);
 	if (bytes < 0)
 		goto bad_client;
 
@@ -1582,7 +1582,7 @@ static void handle_output(struct connection *conn)
 		ignore_connection(conn);
 }
 
-struct connection *new_connection(connwritefn_t *write, connreadfn_t *read)
+struct connection *new_connection(const struct interface_funcs *funcs)
 {
 	struct connection *new;
 
@@ -1592,8 +1592,7 @@ struct connection *new_connection(connwritefn_t *write, connreadfn_t *read)
 
 	new->fd = -1;
 	new->pollfd_idx = -1;
-	new->write = write;
-	new->read = read;
+	new->funcs = funcs;
 	new->is_ignored = false;
 	new->transaction_started = 0;
 	INIT_LIST_HEAD(&new->out_list);
@@ -1622,20 +1621,8 @@ struct connection *get_connection_by_id(unsigned int conn_id)
 static void accept_connection(int sock)
 {
 }
-
-int writefd(struct connection *conn, const void *data, unsigned int len)
-{
-	errno = EBADF;
-	return -1;
-}
-
-int readfd(struct connection *conn, void *data, unsigned int len)
-{
-	errno = EBADF;
-	return -1;
-}
 #else
-int writefd(struct connection *conn, const void *data, unsigned int len)
+static int writefd(struct connection *conn, const void *data, unsigned int len)
 {
 	int rc;
 
@@ -1651,7 +1638,7 @@ int writefd(struct connection *conn, const void *data, unsigned int len)
 	return rc;
 }
 
-int readfd(struct connection *conn, void *data, unsigned int len)
+static int readfd(struct connection *conn, void *data, unsigned int len)
 {
 	int rc;
 
@@ -1673,6 +1660,11 @@ int readfd(struct connection *conn, void *data, unsigned int len)
 	return rc;
 }
 
+const struct interface_funcs socket_funcs = {
+	.write = writefd,
+	.read = readfd,
+};
+
 static void accept_connection(int sock)
 {
 	int fd;
@@ -1682,7 +1674,7 @@ static void accept_connection(int sock)
 	if (fd < 0)
 		return;
 
-	conn = new_connection(writefd, readfd);
+	conn = new_connection(&socket_funcs);
 	if (conn)
 		conn->fd = fd;
 	else
diff --git a/tools/xenstore/xenstored_core.h b/tools/xenstore/xenstored_core.h
index b50ea3f57d..199f6c777a 100644
--- a/tools/xenstore/xenstored_core.h
+++ b/tools/xenstore/xenstored_core.h
@@ -86,8 +86,11 @@ struct delayed_request {
 };
 
 struct connection;
-typedef int connwritefn_t(struct connection *, const void *, unsigned int);
-typedef int connreadfn_t(struct connection *, void *, unsigned int);
+
+struct interface_funcs {
+	int (*write)(struct connection *, const void *, unsigned int);
+	int (*read)(struct connection *, void *, unsigned int);
+};
 
 struct connection
 {
@@ -131,9 +134,8 @@ struct connection
 	/* My watches. */
 	struct list_head watches;
 
-	/* Methods for communicating over this connection: write can be NULL */
-	connwritefn_t *write;
-	connreadfn_t *read;
+	/* Methods for communicating over this connection. */
+	const struct interface_funcs *funcs;
 
 	/* Support for live update: connection id. */
 	unsigned int conn_id;
@@ -196,7 +198,7 @@ int write_node_raw(struct connection *conn, TDB_DATA *key, struct node *node,
 struct node *read_node(struct connection *conn, const void *ctx,
 		       const char *name);
 
-struct connection *new_connection(connwritefn_t *write, connreadfn_t *read);
+struct connection *new_connection(const struct interface_funcs *funcs);
 struct connection *get_connection_by_id(unsigned int conn_id);
 void check_store(void);
 void corrupt(struct connection *conn, const char *fmt, ...);
@@ -256,10 +258,9 @@ void finish_daemonize(void);
 /* Open a pipe for signal handling */
 void init_pipe(int reopen_log_pipe[2]);
 
-int writefd(struct connection *conn, const void *data, unsigned int len);
-int readfd(struct connection *conn, void *data, unsigned int len);
-
-extern struct interface_funcs socket_funcs;
+#ifndef NO_SOCKETS
+extern const struct interface_funcs socket_funcs;
+#endif
 extern xengnttab_handle **xgt_handle;
 
 int remember_string(struct hashtable *hash, const char *str);
diff --git a/tools/xenstore/xenstored_domain.c b/tools/xenstore/xenstored_domain.c
index 0c17937c0f..f3cd56050e 100644
--- a/tools/xenstore/xenstored_domain.c
+++ b/tools/xenstore/xenstored_domain.c
@@ -172,6 +172,11 @@ static int readchn(struct connection *conn, void *data, unsigned int len)
 	return len;
 }
 
+static const struct interface_funcs domain_funcs = {
+	.write = writechn,
+	.read = readchn,
+};
+
 static void *map_interface(domid_t domid)
 {
 	return xengnttab_map_grant_ref(*xgt_handle, domid,
@@ -389,7 +394,7 @@ static int new_domain(struct domain *domain, int port, bool restore)
 
 	domain->introduced = true;
 
-	domain->conn = new_connection(writechn, readchn);
+	domain->conn = new_connection(&domain_funcs);
 	if (!domain->conn)  {
 		errno = ENOMEM;
 		return errno;
@@ -1288,10 +1293,14 @@ void read_state_connection(const void *ctx, const void *state)
 	struct domain *domain, *tdomain;
 
 	if (sc->conn_type == XS_STATE_CONN_TYPE_SOCKET) {
-		conn = new_connection(writefd, readfd);
+#ifdef NO_SOCKETS
+		barf("socket based connection without sockets");
+#else
+		conn = new_connection(&socket_funcs);
 		if (!conn)
 			barf("error restoring connection");
 		conn->fd = sc->spec.socket_fd;
+#endif
 	} else {
 		domain = introduce_domain(ctx, sc->spec.ring.domid,
 					  sc->spec.ring.evtchn, true);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed May 19 05:11:13 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 19 May 2021 05:11:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.129833.243494 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ljEUD-0002Ti-Ck; Wed, 19 May 2021 05:11:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 129833.243494; Wed, 19 May 2021 05:11:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ljEUD-0002Ta-80; Wed, 19 May 2021 05:11:13 +0000
Received: by outflank-mailman (input) for mailman id 129833;
 Wed, 19 May 2021 05:11:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ljEUC-0002Sw-6l
 for xen-changelog@lists.xenproject.org; Wed, 19 May 2021 05:11:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ljEUC-0001j0-5s
 for xen-changelog@lists.xenproject.org; Wed, 19 May 2021 05:11:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ljEUC-0007ew-4u
 for xen-changelog@lists.xenproject.org; Wed, 19 May 2021 05:11:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=8Ei+1Qw+Zx7gqtYlftWDsTyDbm+ISPhSUOnbxdRxFbo=; b=H9lvRKBa5kKCrsxUiWX6NS6vta
	dGrvKtskPmTxmBfLHBHZ8TBYfGyTMhuCN3wSSqDKlfY/WPBk3f5gW/MR/S1okEPfmfrM1djObTwgF
	kYib87GlxW4hetbm+Zz3OlkH5rZ1PmXRmE1JleBNC00lVwsRS3Zw2geVIW+DlMi6D/08=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/xenstore: simplify xenstored main loop
Message-Id: <E1ljEUC-0007ew-4u@xenbits.xenproject.org>
Date: Wed, 19 May 2021 05:11:12 +0000

commit caa9c4471d1d74b2d236467aaf7e63a806ac11a4
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Tue May 18 08:19:07 2021 +0200
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Tue May 18 13:51:28 2021 +0100

    tools/xenstore: simplify xenstored main loop
    
    The main loop of xenstored is rather complicated due to different
    handling of socket and ring-page interfaces. Unify that handling by
    introducing interface type specific functions can_read() and
    can_write().
    
    Take the opportunity to remove the empty list check before calling
    write_messages() because the function is already able to cope with an
    empty list.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
---
 tools/xenstore/xenstored_core.c   | 77 +++++++++++++++++++--------------------
 tools/xenstore/xenstored_core.h   |  2 +
 tools/xenstore/xenstored_domain.c |  2 +
 3 files changed, 41 insertions(+), 40 deletions(-)

diff --git a/tools/xenstore/xenstored_core.c b/tools/xenstore/xenstored_core.c
index 340654855a..df1e54c1f8 100644
--- a/tools/xenstore/xenstored_core.c
+++ b/tools/xenstore/xenstored_core.c
@@ -1660,9 +1660,34 @@ static int readfd(struct connection *conn, void *data, unsigned int len)
 	return rc;
 }
 
+static bool socket_can_process(struct connection *conn, int mask)
+{
+	if (conn->pollfd_idx == -1)
+		return false;
+
+	if (fds[conn->pollfd_idx].revents & ~(POLLIN | POLLOUT)) {
+		talloc_free(conn);
+		return false;
+	}
+
+	return (fds[conn->pollfd_idx].revents & mask) && !conn->is_ignored;
+}
+
+static bool socket_can_write(struct connection *conn)
+{
+	return socket_can_process(conn, POLLOUT);
+}
+
+static bool socket_can_read(struct connection *conn)
+{
+	return socket_can_process(conn, POLLIN);
+}
+
 const struct interface_funcs socket_funcs = {
 	.write = writefd,
 	.read = readfd,
+	.can_write = socket_can_write,
+	.can_read = socket_can_read,
 };
 
 static void accept_connection(int sock)
@@ -2297,47 +2322,19 @@ int main(int argc, char *argv[])
 			if (&next->list != &connections)
 				talloc_increase_ref_count(next);
 
-			if (conn->domain) {
-				if (domain_can_read(conn))
-					handle_input(conn);
-				if (talloc_free(conn) == 0)
-					continue;
-
-				talloc_increase_ref_count(conn);
-				if (domain_can_write(conn) &&
-				    !list_empty(&conn->out_list))
-					handle_output(conn);
-				if (talloc_free(conn) == 0)
-					continue;
-			} else {
-				if (conn->pollfd_idx != -1) {
-					if (fds[conn->pollfd_idx].revents
-					    & ~(POLLIN|POLLOUT))
-						talloc_free(conn);
-					else if ((fds[conn->pollfd_idx].revents
-						  & POLLIN) &&
-						 !conn->is_ignored)
-						handle_input(conn);
-				}
-				if (talloc_free(conn) == 0)
-					continue;
-
-				talloc_increase_ref_count(conn);
-
-				if (conn->pollfd_idx != -1) {
-					if (fds[conn->pollfd_idx].revents
-					    & ~(POLLIN|POLLOUT))
-						talloc_free(conn);
-					else if ((fds[conn->pollfd_idx].revents
-						  & POLLOUT) &&
-						 !conn->is_ignored)
-						handle_output(conn);
-				}
-				if (talloc_free(conn) == 0)
-					continue;
+			if (conn->funcs->can_read(conn))
+				handle_input(conn);
+			if (talloc_free(conn) == 0)
+				continue;
 
-				conn->pollfd_idx = -1;
-			}
+			talloc_increase_ref_count(conn);
+
+			if (conn->funcs->can_write(conn))
+				handle_output(conn);
+			if (talloc_free(conn) == 0)
+				continue;
+
+			conn->pollfd_idx = -1;
 		}
 
 		if (delayed_requests) {
diff --git a/tools/xenstore/xenstored_core.h b/tools/xenstore/xenstored_core.h
index 199f6c777a..da43ec0e02 100644
--- a/tools/xenstore/xenstored_core.h
+++ b/tools/xenstore/xenstored_core.h
@@ -90,6 +90,8 @@ struct connection;
 struct interface_funcs {
 	int (*write)(struct connection *, const void *, unsigned int);
 	int (*read)(struct connection *, void *, unsigned int);
+	bool (*can_write)(struct connection *);
+	bool (*can_read)(struct connection *);
 };
 
 struct connection
diff --git a/tools/xenstore/xenstored_domain.c b/tools/xenstore/xenstored_domain.c
index f3cd56050e..708bf68af0 100644
--- a/tools/xenstore/xenstored_domain.c
+++ b/tools/xenstore/xenstored_domain.c
@@ -175,6 +175,8 @@ static int readchn(struct connection *conn, void *data, unsigned int len)
 static const struct interface_funcs domain_funcs = {
 	.write = writechn,
 	.read = readchn,
+	.can_write = domain_can_write,
+	.can_read = domain_can_read,
 };
 
 static void *map_interface(domid_t domid)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed May 19 12:44:12 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 19 May 2021 12:44:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.130067.243856 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ljLYU-0001h0-4Q; Wed, 19 May 2021 12:44:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 130067.243856; Wed, 19 May 2021 12:44:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ljLYU-0001gs-0P; Wed, 19 May 2021 12:44:06 +0000
Received: by outflank-mailman (input) for mailman id 130067;
 Wed, 19 May 2021 12:44:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ljLYS-0001g1-Iv
 for xen-changelog@lists.xenproject.org; Wed, 19 May 2021 12:44:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ljLYS-0001bS-Gi
 for xen-changelog@lists.xenproject.org; Wed, 19 May 2021 12:44:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ljLYS-00026Y-Ff
 for xen-changelog@lists.xenproject.org; Wed, 19 May 2021 12:44:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=S7/wyv43FBWf3B3VAv8VIJRxZc2A55Xcy9RIH+OkFcM=; b=YrkdWM1YilwCNU4MXPLyyJlxdl
	5+Kqcg04bdnXfuTBEBY1PY5TFNvw477dG0TbjgAmezY++9vn40dWOwKtXCkjC2yABMp1HzEbDibjU
	djRWJb1ePftYdvfOeLJwu1GlssXMuU8Al59c2gxnGwOtIFZFlwdEkceuo98pPJY3q2i4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/libs: guest: Fix Arm build after 8fc4916daf2a
Message-Id: <E1ljLYS-00026Y-Ff@xenbits.xenproject.org>
Date: Wed, 19 May 2021 12:44:04 +0000

commit 935abe1cc463917c697c1451ec8d313a5d75f7de
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue May 18 18:03:05 2021 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Wed May 19 13:35:54 2021 +0100

    tools/libs: guest: Fix Arm build after 8fc4916daf2a
    
    Gitlab CI spotted an issue when building the tools Arm:
    
    xg_dom_arm.c: In function 'meminit':
    xg_dom_arm.c:401:50: error: passing argument 3 of 'set_mode' discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
      401 |     rc = set_mode(dom->xch, dom->guest_domid, dom->guest_type);
          |                                               ~~~^~~~~~~~~~~~
    
    This is because the const was not propagated in the Arm code. Fix it
    by constifying the 3rd parameter of set_mode().
    
    Fixes: 8fc4916daf2a ("tools/libs: guest: Use const whenever we point to literal strings")
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/libs/guest/xg_dom_arm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/libs/guest/xg_dom_arm.c b/tools/libs/guest/xg_dom_arm.c
index b4c24f15fb..01e85e0ea9 100644
--- a/tools/libs/guest/xg_dom_arm.c
+++ b/tools/libs/guest/xg_dom_arm.c
@@ -195,7 +195,7 @@ static int vcpu_arm64(struct xc_dom_image *dom)
 
 /* ------------------------------------------------------------------------ */
 
-static int set_mode(xc_interface *xch, uint32_t domid, char *guest_type)
+static int set_mode(xc_interface *xch, uint32_t domid, const char *guest_type)
 {
     static const struct {
         char           *guest;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed May 19 18:44:09 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 19 May 2021 18:44:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.130310.244167 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ljRAs-000754-A5; Wed, 19 May 2021 18:44:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 130310.244167; Wed, 19 May 2021 18:44:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ljRAs-00074u-74; Wed, 19 May 2021 18:44:06 +0000
Received: by outflank-mailman (input) for mailman id 130310;
 Wed, 19 May 2021 18:44:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ljRAr-000740-5N
 for xen-changelog@lists.xenproject.org; Wed, 19 May 2021 18:44:05 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ljRAr-0008KJ-1e
 for xen-changelog@lists.xenproject.org; Wed, 19 May 2021 18:44:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ljRAr-0005EI-0l
 for xen-changelog@lists.xenproject.org; Wed, 19 May 2021 18:44:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=O3fl/pQnYdCkZ9FwQyT8kqVc6CpKnhpmiX7qp3Hl37Y=; b=wUqv58CwNWmPjyHsnxEG6rCtSU
	z5/kdr29o2aCF1sxGBstNqCbXyT0n7v/OG/NFb1it+BltE9V4vmI++08bQua4QdcCumqsrI0Xme6M
	Zn8BAUwUx8cuNjBtjo3YpIItzAnav1scFgNgSYt8SVnN1PaF4zqmWrJE89ZKQIUK2FW4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] automation: use DOCKER_CMD for building containers too
Message-Id: <E1ljRAr-0005EI-0l@xenbits.xenproject.org>
Date: Wed, 19 May 2021 18:44:05 +0000

commit 65538153a666b8ea2a3bbc0d117a2f8c7f6d8c2e
Author:     Dario Faggioli <dfaggioli@suse.com>
AuthorDate: Tue May 18 18:42:39 2021 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed May 19 19:21:07 2021 +0100

    automation: use DOCKER_CMD for building containers too
    
    Use DOCKER_CMD from the environment (if defined) in the containers'
    makefile too, so that, e.g., when doing `export DOCKED_CMD=podman`
    podman is used for building the containers too.
    
    Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 automation/build/Makefile | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/automation/build/Makefile b/automation/build/Makefile
index 7c7612b1d9..a4b2b85178 100644
--- a/automation/build/Makefile
+++ b/automation/build/Makefile
@@ -2,6 +2,7 @@
 # the base of where these containers will appear
 REGISTRY := registry.gitlab.com/xen-project/xen
 CONTAINERS = $(subst .dockerfile,,$(wildcard */*.dockerfile))
+DOCKER_CMD ?= docker
 
 help:
 	@echo "Builds containers for building Xen based on different distros"
@@ -10,9 +11,9 @@ help:
 	@echo "To push container builds, set the env var PUSH"
 
 %: %.dockerfile ## Builds containers
-	docker build -t $(REGISTRY)/$(@D):$(@F) -f $< $(<D)
+	$(DOCKER_CMD) build -t $(REGISTRY)/$(@D):$(@F) -f $< $(<D)
 	@if [ ! -z $${PUSH+x} ]; then \
-		docker push $(REGISTRY)/$(@D):$(@F); \
+		$(DOCKER_CMD) push $(REGISTRY)/$(@D):$(@F); \
 	fi
 
 .PHONY: all
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed May 19 18:44:16 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 19 May 2021 18:44:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.130311.244172 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ljRB2-00077e-Br; Wed, 19 May 2021 18:44:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 130311.244172; Wed, 19 May 2021 18:44:16 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ljRB2-00077U-8a; Wed, 19 May 2021 18:44:16 +0000
Received: by outflank-mailman (input) for mailman id 130311;
 Wed, 19 May 2021 18:44:15 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ljRB1-00077O-5o
 for xen-changelog@lists.xenproject.org; Wed, 19 May 2021 18:44:15 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ljRB1-0008KU-4u
 for xen-changelog@lists.xenproject.org; Wed, 19 May 2021 18:44:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ljRB1-0005F2-3l
 for xen-changelog@lists.xenproject.org; Wed, 19 May 2021 18:44:15 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=cp2DUvsNcAWKgSj7GRvKysjXtrSUwOp/P+SpCcG+yxs=; b=KN+wk0aDndptl/B6Si8W20lkDm
	A92w2VDTdyT4LcX5dtF0IkG0eEWzjFzYJO1To5GES60pBikRzCeEoqkPBRr+jzr1Qyb7b6eV5SFFd
	3BmKd8U0t/nLEUdt22/kG1gf+jTNlyP+1y5oMriVT45Lz0JRxQIxRtJHLilj1NMtfNjk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] automation: fix dependencies on openSUSE Tumbleweed containers
Message-Id: <E1ljRB1-0005F2-3l@xenbits.xenproject.org>
Date: Wed, 19 May 2021 18:44:15 +0000

commit aa77acc28098d04945af998f3fc0dbd3759b5b41
Author:     Dario Faggioli <dfaggioli@suse.com>
AuthorDate: Tue May 18 18:42:45 2021 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed May 19 19:21:08 2021 +0100

    automation: fix dependencies on openSUSE Tumbleweed containers
    
    Fix the build inside our openSUSE Tumbleweed container by using
    adding libzstd headers. While there, remove the explicit dependency
    for python and python3 as the respective -devel packages will pull
    them in anyway.
    
    Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 automation/build/suse/opensuse-tumbleweed.dockerfile | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/automation/build/suse/opensuse-tumbleweed.dockerfile b/automation/build/suse/opensuse-tumbleweed.dockerfile
index 8ff7b9b5ce..a33ab0d870 100644
--- a/automation/build/suse/opensuse-tumbleweed.dockerfile
+++ b/automation/build/suse/opensuse-tumbleweed.dockerfile
@@ -45,6 +45,7 @@ RUN zypper install -y --no-recommends \
         libtasn1-devel \
         libuuid-devel \
         libyajl-devel \
+        libzstd-devel \
         lzo-devel \
         make \
         nasm \
@@ -56,9 +57,7 @@ RUN zypper install -y --no-recommends \
         pandoc \
         patch \
         pkg-config \
-        python \
         python-devel \
-        python3 \
         python3-devel \
         systemd-devel \
         tar \
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu May 20 07:33:11 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 May 2021 07:33:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.130670.244619 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ljdB1-00031q-KP; Thu, 20 May 2021 07:33:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 130670.244619; Thu, 20 May 2021 07:33:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ljdB1-00031i-HZ; Thu, 20 May 2021 07:33:03 +0000
Received: by outflank-mailman (input) for mailman id 130670;
 Thu, 20 May 2021 07:33:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ljdB0-00031c-5j
 for xen-changelog@lists.xenproject.org; Thu, 20 May 2021 07:33:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ljdB0-0002cH-44
 for xen-changelog@lists.xenproject.org; Thu, 20 May 2021 07:33:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ljdB0-0001qc-35
 for xen-changelog@lists.xenproject.org; Thu, 20 May 2021 07:33:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=j3cVnMQ1LNn8ly5Up7WAL2B5v5XKP6c/7WVcGSTyRDc=; b=5RFqRqPoBqEjOCX+PQl0+U3sBr
	mJQsfGsr0f612PVjjh2mX4kGAxFoUqTj+dBKKQQ1hobLV8RU/BYzFwRNBctHbfSoqWkAVFFKhrciw
	JEXcyo8H0PdTib/NmOtTOMEgFmy0MFserUiMw3cHKS3AWh6KZzpwYRHHcm+2cq4l8ejA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/libs: guest: Use const whenever we point to literal strings
Message-Id: <E1ljdB0-0001qc-35@xenbits.xenproject.org>
Date: Thu, 20 May 2021 07:33:02 +0000

commit 8fc4916daf2aac34088ebd5ec3d6fd707ac4221d
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue May 18 14:34:22 2021 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Tue May 18 14:54:05 2021 +0100

    tools/libs: guest: Use const whenever we point to literal strings
    
    literal strings are not meant to be modified. So we should use const
    *char rather than char * when we want to store a pointer to them.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
    Acked-by: Wei Liu <wl@xen.org>
---
 tools/include/xenguest.h            | 10 +++++-----
 tools/libs/guest/xg_dom_core.c      |  8 ++++----
 tools/libs/guest/xg_dom_elfloader.c |  4 ++--
 tools/libs/guest/xg_dom_hvmloader.c |  2 +-
 tools/libs/guest/xg_dom_x86.c       |  7 ++++---
 tools/libs/guest/xg_private.h       |  2 +-
 6 files changed, 17 insertions(+), 16 deletions(-)

diff --git a/tools/include/xenguest.h b/tools/include/xenguest.h
index 217022b6e7..a4492038cf 100644
--- a/tools/include/xenguest.h
+++ b/tools/include/xenguest.h
@@ -108,7 +108,7 @@ struct xc_dom_image {
 
     /* info from (elf) kernel image */
     struct elf_dom_parms *parms;
-    char *guest_type;
+    const char *guest_type;
 
     /* memory layout */
     struct xc_dom_seg kernel_seg;
@@ -266,8 +266,8 @@ struct xc_dom_arch {
     /* arch-specific memory initialization. */
     int (*meminit) (struct xc_dom_image * dom);
 
-    char *guest_type;
-    char *native_protocol;
+    const char *guest_type;
+    const char *native_protocol;
     int page_shift;
     int sizeof_pfn;
     int p2m_base_supported;
@@ -374,9 +374,9 @@ char *xc_dom_strdup(struct xc_dom_image *dom, const char *str);
 
 /* --- alloc memory pool ------------------------------------------- */
 
-xen_pfn_t xc_dom_alloc_page(struct xc_dom_image *dom, char *name);
+xen_pfn_t xc_dom_alloc_page(struct xc_dom_image *dom, const char *name);
 int xc_dom_alloc_segment(struct xc_dom_image *dom,
-                         struct xc_dom_seg *seg, char *name,
+                         struct xc_dom_seg *seg, const char *name,
                          xen_vaddr_t start, xen_vaddr_t size);
 
 /* --- misc bits --------------------------------------------------- */
diff --git a/tools/libs/guest/xg_dom_core.c b/tools/libs/guest/xg_dom_core.c
index 98ef8e8fc9..4918ee517b 100644
--- a/tools/libs/guest/xg_dom_core.c
+++ b/tools/libs/guest/xg_dom_core.c
@@ -422,7 +422,7 @@ void *xc_dom_pfn_to_ptr_retcount(struct xc_dom_image *dom, xen_pfn_t pfn,
     struct xc_dom_phys *phys;
     xen_pfn_t offset;
     unsigned int page_shift = XC_DOM_PAGE_SHIFT(dom);
-    char *mode = "unset";
+    const char *mode = "unset";
 
     *count_out = 0;
 
@@ -525,7 +525,7 @@ void *xc_dom_pfn_to_ptr_retcount(struct xc_dom_image *dom, xen_pfn_t pfn,
     return phys->ptr;
 }
 
-static int xc_dom_chk_alloc_pages(struct xc_dom_image *dom, char *name,
+static int xc_dom_chk_alloc_pages(struct xc_dom_image *dom, const char *name,
                                   xen_pfn_t pages)
 {
     unsigned int page_size = XC_DOM_PAGE_SIZE(dom);
@@ -576,7 +576,7 @@ static int xc_dom_alloc_pad(struct xc_dom_image *dom, xen_vaddr_t boundary)
 }
 
 int xc_dom_alloc_segment(struct xc_dom_image *dom,
-                         struct xc_dom_seg *seg, char *name,
+                         struct xc_dom_seg *seg, const char *name,
                          xen_vaddr_t start, xen_vaddr_t size)
 {
     unsigned int page_size = XC_DOM_PAGE_SIZE(dom);
@@ -611,7 +611,7 @@ int xc_dom_alloc_segment(struct xc_dom_image *dom,
     return 0;
 }
 
-xen_pfn_t xc_dom_alloc_page(struct xc_dom_image *dom, char *name)
+xen_pfn_t xc_dom_alloc_page(struct xc_dom_image *dom, const char *name)
 {
     xen_vaddr_t start;
     xen_pfn_t pfn;
diff --git a/tools/libs/guest/xg_dom_elfloader.c b/tools/libs/guest/xg_dom_elfloader.c
index 06e713fe11..0d6247db5d 100644
--- a/tools/libs/guest/xg_dom_elfloader.c
+++ b/tools/libs/guest/xg_dom_elfloader.c
@@ -50,8 +50,8 @@ void xc_elf_set_logfile(xc_interface *xch, struct elf_binary *elf,
 
 /* ------------------------------------------------------------------------ */
 
-static char *xc_dom_guest_type(struct xc_dom_image *dom,
-                               struct elf_binary *elf)
+static const char *xc_dom_guest_type(struct xc_dom_image *dom,
+                                     struct elf_binary *elf)
 {
     uint64_t machine = elf_uval(elf, elf->ehdr, e_machine);
 
diff --git a/tools/libs/guest/xg_dom_hvmloader.c b/tools/libs/guest/xg_dom_hvmloader.c
index ec6ebad7fd..4e6f30858a 100644
--- a/tools/libs/guest/xg_dom_hvmloader.c
+++ b/tools/libs/guest/xg_dom_hvmloader.c
@@ -130,7 +130,7 @@ static elf_errorstatus xc_dom_parse_hvm_kernel(struct xc_dom_image *dom)
 
 static int module_init_one(struct xc_dom_image *dom,
                            struct xc_hvm_firmware_module *module,
-                           char *name)
+                           const char *name)
 {
     struct xc_dom_seg seg;
     void *dest;
diff --git a/tools/libs/guest/xg_dom_x86.c b/tools/libs/guest/xg_dom_x86.c
index 2953aeb90b..d2eb89ce01 100644
--- a/tools/libs/guest/xg_dom_x86.c
+++ b/tools/libs/guest/xg_dom_x86.c
@@ -1148,10 +1148,11 @@ static int vcpu_hvm(struct xc_dom_image *dom)
 
 /* ------------------------------------------------------------------------ */
 
-static int x86_compat(xc_interface *xch, uint32_t domid, char *guest_type)
+static int x86_compat(xc_interface *xch, uint32_t domid,
+                      const char *guest_type)
 {
     static const struct {
-        char           *guest;
+        const char      *guest;
         uint32_t        size;
     } types[] = {
         { "xen-3.0-x86_32p", 32 },
@@ -1664,7 +1665,7 @@ static int bootearly(struct xc_dom_image *dom)
 static int bootlate_pv(struct xc_dom_image *dom)
 {
     static const struct {
-        char *guest;
+        const char *guest;
         unsigned long pgd_type;
     } types[] = {
         { "xen-3.0-x86_32",  MMUEXT_PIN_L2_TABLE},
diff --git a/tools/libs/guest/xg_private.h b/tools/libs/guest/xg_private.h
index 8f9b257a2f..25e46d7ce1 100644
--- a/tools/libs/guest/xg_private.h
+++ b/tools/libs/guest/xg_private.h
@@ -43,7 +43,7 @@
 #endif
 
 struct xc_dom_loader {
-    char *name;
+    const char *name;
     /* Sadly the error returns from these functions are not consistent: */
     elf_negerrnoval (*probe) (struct xc_dom_image * dom);
     elf_negerrnoval (*parser) (struct xc_dom_image * dom);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu May 20 07:33:13 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 May 2021 07:33:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.130671.244624 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ljdBB-00035Q-MX; Thu, 20 May 2021 07:33:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 130671.244624; Thu, 20 May 2021 07:33:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ljdBB-00035I-J6; Thu, 20 May 2021 07:33:13 +0000
Received: by outflank-mailman (input) for mailman id 130671;
 Thu, 20 May 2021 07:33:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ljdBA-000356-7z
 for xen-changelog@lists.xenproject.org; Thu, 20 May 2021 07:33:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ljdBA-0002cL-7A
 for xen-changelog@lists.xenproject.org; Thu, 20 May 2021 07:33:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ljdBA-0001rH-6C
 for xen-changelog@lists.xenproject.org; Thu, 20 May 2021 07:33:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=poTmVcS98EJqk7Y3zNHMK0HCnKWRzkhpiw/BOtYFlgA=; b=0V2Mnr4fa+Wrp4cuFwWa7QxDYL
	WgWk9RO1FJEgc40MM+J9ciqbnY11xiVHquWN6758SZolmcSVoeUnXGnwxHTjGAkGOlG4I85PsWi1M
	0Z7WYaly9USHoQ7861gkval5ypfU+dSLndAHVdScElcLCfzGewY4YrIOI32/7LCaItRo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/libs: stat: Use const whenever we point to literal strings
Message-Id: <E1ljdBA-0001rH-6C@xenbits.xenproject.org>
Date: Thu, 20 May 2021 07:33:12 +0000

commit 89aae4ad8f495b647de33f2df5046b3ce68225f8
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue May 18 14:35:07 2021 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Tue May 18 14:54:05 2021 +0100

    tools/libs: stat: Use const whenever we point to literal strings
    
    literal strings are not meant to be modified. So we should use const
    char * rather than char * when we want to store a pointer to them.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
    Acked-by: Wei Liu <wl@xen.org>
---
 tools/libs/stat/xenstat_linux.c |  4 ++--
 tools/libs/stat/xenstat_qmp.c   | 12 ++++++------
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/tools/libs/stat/xenstat_linux.c b/tools/libs/stat/xenstat_linux.c
index c00b26d4d8..875a0617ad 100644
--- a/tools/libs/stat/xenstat_linux.c
+++ b/tools/libs/stat/xenstat_linux.c
@@ -66,7 +66,7 @@ static const char PROCNETDEV_HEADER[] =
 
 /* We need to get the name of the bridge interface for use with bonding interfaces */
 /* Use excludeName parameter to avoid adding bridges we don't care about, eg. virbr0 */
-static void getBridge(char *excludeName, char *result, size_t resultLen)
+static void getBridge(const char *excludeName, char *result, size_t resultLen)
 {
 	struct dirent *de;
 	DIR *d;
@@ -113,7 +113,7 @@ static int parseNetDevLine(char *line, char *iface, unsigned long long *rxBytes,
 	int num = 19;
 
 	/* Regular exception to parse all the information from /proc/net/dev line */
-	char *regex = "([^:]*):([^ ]*)[ ]*([^ ]*)[ ]*([^ ]*)[ ]*([^ ]*)[ ]*([^ ]*)[ ]*([^ ]*)"
+	const char *regex = "([^:]*):([^ ]*)[ ]*([^ ]*)[ ]*([^ ]*)[ ]*([^ ]*)[ ]*([^ ]*)[ ]*([^ ]*)"
 			"[ ]*([^ ]*)[ ]*([^ ]*)[ ]*([^ ]*)[ ]*([^ ]*)[ ]*([^ ]*)[ ]*([^ ]*)[ ]*"
 			"([^ ]*)[ ]*([^ ]*)[ ]*([^ ]*)[ ]*([^ ]*)[ ]*([^ ]*)";
 
diff --git a/tools/libs/stat/xenstat_qmp.c b/tools/libs/stat/xenstat_qmp.c
index 0c5748ba68..2205a04131 100644
--- a/tools/libs/stat/xenstat_qmp.c
+++ b/tools/libs/stat/xenstat_qmp.c
@@ -38,7 +38,7 @@
 
 #include <yajl/yajl_tree.h>
 
-static unsigned char *qmp_query(int, char *);
+static unsigned char *qmp_query(int, const char *);
 
 enum query_blockstats {
     QMP_STATS_RETURN  = 0,
@@ -80,7 +80,7 @@ enum query_block {
 static char *qmp_get_block_image(xenstat_node *node, char *qmp_devname, int qfd)
 {
 	char *tmp, *file = NULL;
-	char *query_block_cmd = "{ \"execute\": \"query-block\" }";
+	const char *query_block_cmd = "{ \"execute\": \"query-block\" }";
 	static const char *const qblock[] = {
 		[ QMP_BLOCK_RETURN  ] = "return",
 		[ QMP_BLOCK_DEVICE  ] = "device",
@@ -264,7 +264,7 @@ done:
 }
 
 /* Write a command via the QMP. Returns number of bytes written */
-static size_t qmp_write(int qfd, char *cmd, size_t cmd_len)
+static size_t qmp_write(int qfd, const char *cmd, size_t cmd_len)
 {
 	size_t pos = 0;
 	ssize_t res;
@@ -317,7 +317,7 @@ static int qmp_read(int qfd, unsigned char **qstats)
 }
 
 /* With the given cmd, query QMP for requested data. Returns allocated buffer containing data or NULL */
-static unsigned char *qmp_query(int qfd, char *cmd)
+static unsigned char *qmp_query(int qfd, const char *cmd)
 {
 	unsigned char *qstats = NULL;
 	int n;
@@ -385,8 +385,8 @@ static int qmp_connect(char *path)
 */
 static void read_attributes_qdisk_dom(xenstat_node *node, domid_t domain)
 {
-	char *cmd_mode = "{ \"execute\": \"qmp_capabilities\" }";
-	char *query_blockstats_cmd = "{ \"execute\": \"query-blockstats\" }";
+	const char *cmd_mode = "{ \"execute\": \"qmp_capabilities\" }";
+	const char *query_blockstats_cmd = "{ \"execute\": \"query-blockstats\" }";
 	unsigned char *qmp_stats, *val;
 	char path[80];
 	int qfd;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu May 20 07:33:23 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 May 2021 07:33:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.130672.244628 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ljdBL-00038W-OE; Thu, 20 May 2021 07:33:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 130672.244628; Thu, 20 May 2021 07:33:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ljdBL-00038P-Kx; Thu, 20 May 2021 07:33:23 +0000
Received: by outflank-mailman (input) for mailman id 130672;
 Thu, 20 May 2021 07:33:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ljdBK-000385-BG
 for xen-changelog@lists.xenproject.org; Thu, 20 May 2021 07:33:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ljdBK-0002cc-AO
 for xen-changelog@lists.xenproject.org; Thu, 20 May 2021 07:33:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ljdBK-0001tL-9J
 for xen-changelog@lists.xenproject.org; Thu, 20 May 2021 07:33:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=73Q0Y6owdPM2CU2qDyGXSElisAetCxyvkEq5/Pdm1ww=; b=xWgc05eHM32Ew+YUPPm0Ayz6DH
	UEpb5v+KSkh+mPr7Bsgcvi3sBrVN7ZBjVKVozSHAeApUOTpeoBE7PGjUZLVG8d+8iq5OTdUwdwzJC
	vYzQeg+xzzlXLQt4jLOORJUpu2HpPmoHnzf12g+tl/MLGgc/62KgoxsZz4UTKYsKS5JY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/misc: Use const whenever we point to literal strings
Message-Id: <E1ljdBK-0001tL-9J@xenbits.xenproject.org>
Date: Thu, 20 May 2021 07:33:22 +0000

commit 5605cfd49a18df41a21fb50cd81528312a39d7c9
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue May 18 14:50:32 2021 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Tue May 18 14:54:05 2021 +0100

    tools/misc: Use const whenever we point to literal strings
    
    literal strings are not meant to be modified. So we should use const
    char * rather than char * when we we to store a pointer to them.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
    Acked-by: Wei Liu <wl@xen.org>
---
 tools/misc/xen-detect.c | 2 +-
 tools/misc/xenhypfs.c   | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/misc/xen-detect.c b/tools/misc/xen-detect.c
index eac9e46a35..18b28dabf3 100644
--- a/tools/misc/xen-detect.c
+++ b/tools/misc/xen-detect.c
@@ -44,7 +44,7 @@ enum guest_type {
     XEN_NONE = 3
 };
 
-static char *type;
+static const char *type;
 static char *ver;
 
 static void cpuid(uint32_t idx, uint32_t *regs, int pv_context)
diff --git a/tools/misc/xenhypfs.c b/tools/misc/xenhypfs.c
index 5da24aed90..df398b07bd 100644
--- a/tools/misc/xenhypfs.c
+++ b/tools/misc/xenhypfs.c
@@ -81,9 +81,9 @@ static int xenhypfs_wr(char *path, char *val)
     return ret;
 }
 
-static char *xenhypfs_type(struct xenhypfs_dirent *ent)
+static const char *xenhypfs_type(struct xenhypfs_dirent *ent)
 {
-    char *res;
+    const char *res;
 
     switch (ent->type) {
     case xenhypfs_type_dir:
@@ -134,7 +134,7 @@ static int xenhypfs_ls(char *path)
     return ret;
 }
 
-static int xenhypfs_tree_sub(char *path, unsigned int depth)
+static int xenhypfs_tree_sub(const char *path, unsigned int depth)
 {
     struct xenhypfs_dirent *ent;
     unsigned int n, i;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu May 20 07:33:33 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 May 2021 07:33:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.130673.244632 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ljdBV-0003By-Pl; Thu, 20 May 2021 07:33:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 130673.244632; Thu, 20 May 2021 07:33:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ljdBV-0003Bq-Mf; Thu, 20 May 2021 07:33:33 +0000
Received: by outflank-mailman (input) for mailman id 130673;
 Thu, 20 May 2021 07:33:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ljdBU-0003BY-E1
 for xen-changelog@lists.xenproject.org; Thu, 20 May 2021 07:33:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ljdBU-0002cm-DH
 for xen-changelog@lists.xenproject.org; Thu, 20 May 2021 07:33:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ljdBU-0001tx-CP
 for xen-changelog@lists.xenproject.org; Thu, 20 May 2021 07:33:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=vy90/tsI84I6Ud2CRjK/eJv+I01KzkPqo5V0tGtbQSE=; b=UUSN7vs6FqROsRVhbmTVDjt45e
	eowVZj65axCEHkO80V7mMOM592ECRdloveD40RDo9s/VRQYtshH2+lM8Y1N0+IoxEkxGi7UC8vEp0
	6EPvuHHIm/i7ZKBZS/vOWskRSyPWZnzLtpus9ovEY7mVoyXLfdUxKdLZsgN5PCUiDgFo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/top: The string parameter in set_prompt() and set_delay() should be const
Message-Id: <E1ljdBU-0001tx-CP@xenbits.xenproject.org>
Date: Thu, 20 May 2021 07:33:32 +0000

commit 4b7702727a8d89fea0a239adcbeb18aa2c85ede0
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue May 18 14:51:28 2021 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Tue May 18 14:54:05 2021 +0100

    tools/top: The string parameter in set_prompt() and set_delay() should be const
    
    Neither string parameter in set_prompt() and set_delay() are meant to
    be modified. In particular, new_prompt can point to a literal string.
    
    So mark the two parameters as const and propagate it.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
    Acked-by: Wei Liu <wl@xen.org>
---
 tools/xentop/xentop.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/tools/xentop/xentop.c b/tools/xentop/xentop.c
index ebed070c0f..950e8935c4 100644
--- a/tools/xentop/xentop.c
+++ b/tools/xentop/xentop.c
@@ -81,8 +81,8 @@ static int current_row(void);
 static int lines(void);
 static void print(const char *, ...) __attribute__((format(printf,1,2)));
 static void attr_addstr(int attr, const char *str);
-static void set_delay(char *value);
-static void set_prompt(char *new_prompt, void (*func)(char *));
+static void set_delay(const char *value);
+static void set_prompt(const char *new_prompt, void (*func)(const char *));
 static int handle_key(int);
 static int compare(unsigned long long, unsigned long long);
 static int compare_domains(xenstat_domain **, xenstat_domain **);
@@ -212,10 +212,10 @@ int show_vbds = 0;
 int repeat_header = 0;
 int show_full_name = 0;
 #define PROMPT_VAL_LEN 80
-char *prompt = NULL;
+const char *prompt = NULL;
 char prompt_val[PROMPT_VAL_LEN];
 int prompt_val_len = 0;
-void (*prompt_complete_func)(char *);
+void (*prompt_complete_func)(const char *);
 
 static WINDOW *cwin;
 
@@ -331,7 +331,7 @@ static void attr_addstr(int attr, const char *str)
 }
 
 /* Handle setting the delay from the user-supplied value in prompt_val */
-static void set_delay(char *value)
+static void set_delay(const char *value)
 {
 	int new_delay;
 	new_delay = atoi(value);
@@ -341,7 +341,7 @@ static void set_delay(char *value)
 
 /* Enable prompting mode with the given prompt string; call the given function
  * when a value is available. */
-static void set_prompt(char *new_prompt, void (*func)(char *))
+static void set_prompt(const char *new_prompt, void (*func)(const char *))
 {
 	prompt = new_prompt;
 	prompt_val[0] = '\0';
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu May 20 07:33:43 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 May 2021 07:33:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.130674.244636 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ljdBf-0003G3-Sw; Thu, 20 May 2021 07:33:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 130674.244636; Thu, 20 May 2021 07:33:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ljdBf-0003Fr-Pn; Thu, 20 May 2021 07:33:43 +0000
Received: by outflank-mailman (input) for mailman id 130674;
 Thu, 20 May 2021 07:33:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ljdBe-0003Fd-H1
 for xen-changelog@lists.xenproject.org; Thu, 20 May 2021 07:33:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ljdBe-0002dO-GF
 for xen-changelog@lists.xenproject.org; Thu, 20 May 2021 07:33:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ljdBe-0001un-FO
 for xen-changelog@lists.xenproject.org; Thu, 20 May 2021 07:33:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=2flOU14GJxl4+9dWQEVOCyxvgaQGcSGosP53AK5Gkm4=; b=mTioxCQYdP9O+34pipdKosxLoU
	kTpLEwbEu+dTC0u9jINKrIPZ4+1Ta8hfGxRf76pYCt/zm8aLFcp8kw9L631cqajKJRyUfbDDCjgiA
	7PLDwXDZtfATjcCjAu+aC5+fhbkFrmDS9plLOiQPI7P+YYSB8yT7/zB8A0IkGkiWGCuA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/xenmon: xenbaked: Mark const the field text in stat_map_t
Message-Id: <E1ljdBe-0001un-FO@xenbits.xenproject.org>
Date: Thu, 20 May 2021 07:33:42 +0000

commit 01d84420fb4a9be2ec474a7c1910bb22c28b53c8
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue May 18 14:51:48 2021 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Tue May 18 14:54:05 2021 +0100

    tools/xenmon: xenbaked: Mark const the field text in stat_map_t
    
    The field text in stat_map_t will point to string literals. So mark it
    as const to allow the compiler to catch any modified of the string.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
    Acked-by: Wei Liu <wl@xen.org>
---
 tools/xenmon/xenbaked.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/xenmon/xenbaked.c b/tools/xenmon/xenbaked.c
index d3f940a26b..1ed34334c8 100644
--- a/tools/xenmon/xenbaked.c
+++ b/tools/xenmon/xenbaked.c
@@ -182,7 +182,7 @@ typedef struct
 {
     int event_count;
     int event_id;
-    char *text;
+    const char *text;
 } stat_map_t;
 
 stat_map_t stat_map[] = {
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu May 20 07:33:53 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 May 2021 07:33:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.130675.244640 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ljdBp-0003J5-UI; Thu, 20 May 2021 07:33:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 130675.244640; Thu, 20 May 2021 07:33:53 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ljdBp-0003Ix-RI; Thu, 20 May 2021 07:33:53 +0000
Received: by outflank-mailman (input) for mailman id 130675;
 Thu, 20 May 2021 07:33:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ljdBo-0003Im-Ju
 for xen-changelog@lists.xenproject.org; Thu, 20 May 2021 07:33:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ljdBo-0002dX-JE
 for xen-changelog@lists.xenproject.org; Thu, 20 May 2021 07:33:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ljdBo-0001vQ-IH
 for xen-changelog@lists.xenproject.org; Thu, 20 May 2021 07:33:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=LSBs48VdNhbmv4HwdxoQ49L+dUs32DwKPN1xhPzFAT0=; b=eUZl89Gcv3aDcnh7EVlDKVF0sx
	xTHUUfIdxloTnn1CWccva50r3Gi4d1G640f73lomkFJZBQkuzgxNVTnfulBdL3m10vXODN2HgziAl
	c4mDYcifiCA6/MEp3ArBNUOZdTPjFI0OhlVJZbKI0oRBB9YH1cYwHu92Y+UqjFkIsh3g=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/libs: guest: Fix Arm build after 8fc4916daf2a
Message-Id: <E1ljdBo-0001vQ-IH@xenbits.xenproject.org>
Date: Thu, 20 May 2021 07:33:52 +0000

commit 935abe1cc463917c697c1451ec8d313a5d75f7de
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue May 18 18:03:05 2021 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Wed May 19 13:35:54 2021 +0100

    tools/libs: guest: Fix Arm build after 8fc4916daf2a
    
    Gitlab CI spotted an issue when building the tools Arm:
    
    xg_dom_arm.c: In function 'meminit':
    xg_dom_arm.c:401:50: error: passing argument 3 of 'set_mode' discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
      401 |     rc = set_mode(dom->xch, dom->guest_domid, dom->guest_type);
          |                                               ~~~^~~~~~~~~~~~
    
    This is because the const was not propagated in the Arm code. Fix it
    by constifying the 3rd parameter of set_mode().
    
    Fixes: 8fc4916daf2a ("tools/libs: guest: Use const whenever we point to literal strings")
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/libs/guest/xg_dom_arm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/libs/guest/xg_dom_arm.c b/tools/libs/guest/xg_dom_arm.c
index b4c24f15fb..01e85e0ea9 100644
--- a/tools/libs/guest/xg_dom_arm.c
+++ b/tools/libs/guest/xg_dom_arm.c
@@ -195,7 +195,7 @@ static int vcpu_arm64(struct xc_dom_image *dom)
 
 /* ------------------------------------------------------------------------ */
 
-static int set_mode(xc_interface *xch, uint32_t domid, char *guest_type)
+static int set_mode(xc_interface *xch, uint32_t domid, const char *guest_type)
 {
     static const struct {
         char           *guest;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu May 20 17:55:12 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 May 2021 17:55:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.131056.245139 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ljmsx-0002BQ-SP; Thu, 20 May 2021 17:55:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 131056.245139; Thu, 20 May 2021 17:55:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ljmsx-0002BI-PD; Thu, 20 May 2021 17:55:03 +0000
Received: by outflank-mailman (input) for mailman id 131056;
 Thu, 20 May 2021 17:55:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ljmsw-0002BC-4c
 for xen-changelog@lists.xenproject.org; Thu, 20 May 2021 17:55:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ljmsw-0005w4-2r
 for xen-changelog@lists.xenproject.org; Thu, 20 May 2021 17:55:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ljmsw-0006FA-1x
 for xen-changelog@lists.xenproject.org; Thu, 20 May 2021 17:55:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=/MsKGvmN+aMKKI4brtrJ/VKr+61rmquiWisw5MgcN0Y=; b=SiC/ceg7Nvs59VIqiRF5km7CkG
	HdhqSjA8mREIVcYDEy+PUac8cc7cefZjuUn6I/TDtjHhKdafszlb+AIt9R3FMiXoQeUHTl6QTtVIL
	L6JJnEu0SMaVgekTxGBswGz0ewiaxRLq8RT3uxOG6RKSvR81MfvZ3suxycyEP88T2qvk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation: use DOCKER_CMD for building containers too
Message-Id: <E1ljmsw-0006FA-1x@xenbits.xenproject.org>
Date: Thu, 20 May 2021 17:55:02 +0000

commit 65538153a666b8ea2a3bbc0d117a2f8c7f6d8c2e
Author:     Dario Faggioli <dfaggioli@suse.com>
AuthorDate: Tue May 18 18:42:39 2021 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed May 19 19:21:07 2021 +0100

    automation: use DOCKER_CMD for building containers too
    
    Use DOCKER_CMD from the environment (if defined) in the containers'
    makefile too, so that, e.g., when doing `export DOCKED_CMD=podman`
    podman is used for building the containers too.
    
    Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 automation/build/Makefile | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/automation/build/Makefile b/automation/build/Makefile
index 7c7612b1d9..a4b2b85178 100644
--- a/automation/build/Makefile
+++ b/automation/build/Makefile
@@ -2,6 +2,7 @@
 # the base of where these containers will appear
 REGISTRY := registry.gitlab.com/xen-project/xen
 CONTAINERS = $(subst .dockerfile,,$(wildcard */*.dockerfile))
+DOCKER_CMD ?= docker
 
 help:
 	@echo "Builds containers for building Xen based on different distros"
@@ -10,9 +11,9 @@ help:
 	@echo "To push container builds, set the env var PUSH"
 
 %: %.dockerfile ## Builds containers
-	docker build -t $(REGISTRY)/$(@D):$(@F) -f $< $(<D)
+	$(DOCKER_CMD) build -t $(REGISTRY)/$(@D):$(@F) -f $< $(<D)
 	@if [ ! -z $${PUSH+x} ]; then \
-		docker push $(REGISTRY)/$(@D):$(@F); \
+		$(DOCKER_CMD) push $(REGISTRY)/$(@D):$(@F); \
 	fi
 
 .PHONY: all
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu May 20 17:55:13 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 May 2021 17:55:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.131057.245143 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ljmt7-0002D4-UA; Thu, 20 May 2021 17:55:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 131057.245143; Thu, 20 May 2021 17:55:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ljmt7-0002Cv-Qs; Thu, 20 May 2021 17:55:13 +0000
Received: by outflank-mailman (input) for mailman id 131057;
 Thu, 20 May 2021 17:55:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ljmt6-0002Cb-6w
 for xen-changelog@lists.xenproject.org; Thu, 20 May 2021 17:55:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ljmt6-0005w8-68
 for xen-changelog@lists.xenproject.org; Thu, 20 May 2021 17:55:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ljmt6-0006Fs-56
 for xen-changelog@lists.xenproject.org; Thu, 20 May 2021 17:55:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=yYnJU5hepOgqEUcxY5TlFmS7ZoIaRqTXmX6RXmk3ucQ=; b=cmFPDwk6EIHN8vlYn66w6hNgIg
	/qhPv79XV9BQNBpwI79rZskXhiWuwN9nMA/BG3Iwe89QBkq3dsH7E/nNdM3MUpwT2t8IsOTvBUDRf
	fKzTWP1vuoq+T/jWABgX/93vSK6a8GB8opF1baPC7LvP3zInmFFHvWRiIDuBXaneWRN4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation: fix dependencies on openSUSE Tumbleweed containers
Message-Id: <E1ljmt6-0006Fs-56@xenbits.xenproject.org>
Date: Thu, 20 May 2021 17:55:12 +0000

commit aa77acc28098d04945af998f3fc0dbd3759b5b41
Author:     Dario Faggioli <dfaggioli@suse.com>
AuthorDate: Tue May 18 18:42:45 2021 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed May 19 19:21:08 2021 +0100

    automation: fix dependencies on openSUSE Tumbleweed containers
    
    Fix the build inside our openSUSE Tumbleweed container by using
    adding libzstd headers. While there, remove the explicit dependency
    for python and python3 as the respective -devel packages will pull
    them in anyway.
    
    Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 automation/build/suse/opensuse-tumbleweed.dockerfile | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/automation/build/suse/opensuse-tumbleweed.dockerfile b/automation/build/suse/opensuse-tumbleweed.dockerfile
index 8ff7b9b5ce..a33ab0d870 100644
--- a/automation/build/suse/opensuse-tumbleweed.dockerfile
+++ b/automation/build/suse/opensuse-tumbleweed.dockerfile
@@ -45,6 +45,7 @@ RUN zypper install -y --no-recommends \
         libtasn1-devel \
         libuuid-devel \
         libyajl-devel \
+        libzstd-devel \
         lzo-devel \
         make \
         nasm \
@@ -56,9 +57,7 @@ RUN zypper install -y --no-recommends \
         pandoc \
         patch \
         pkg-config \
-        python \
         python-devel \
-        python3 \
         python3-devel \
         systemd-devel \
         tar \
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue May 25 07:11:11 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 25 May 2021 07:11:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.132086.246515 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1llRDW-0000nW-3Y; Tue, 25 May 2021 07:11:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 132086.246515; Tue, 25 May 2021 07:11:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1llRDW-0000nN-0X; Tue, 25 May 2021 07:11:06 +0000
Received: by outflank-mailman (input) for mailman id 132086;
 Tue, 25 May 2021 07:11:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1llRDU-0000nH-Do
 for xen-changelog@lists.xenproject.org; Tue, 25 May 2021 07:11:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1llRDU-0003t8-BD
 for xen-changelog@lists.xenproject.org; Tue, 25 May 2021 07:11:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1llRDU-0006po-AJ
 for xen-changelog@lists.xenproject.org; Tue, 25 May 2021 07:11:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Fbnx01HJuOjLlXi5JZYv1kvRA1Skx3Xwi1zN1o1lFyw=; b=Yyyv8VVAVU7jVQwG6nH044Z01q
	C9vewZa5Nira6z6xd2STwQnqe++Rx7BJXwdB9VFRWAUT7o4vr3gzk63Z1TdzcbAVCVwUyCaAmmqKr
	76bMhvCOWTDtDoLtpteIZVyRQqMm1f5x2GJjQ1fpnKboPyuDncxP812Su3jEcAK5Lbn4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/shadow: fix DO_UNSHADOW()
Message-Id: <E1llRDU-0006po-AJ@xenbits.xenproject.org>
Date: Tue, 25 May 2021 07:11:04 +0000

commit 81acb1d7bdd5b1bf9c3422dcfeda616db2405d6f
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue May 25 09:08:43 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue May 25 09:08:43 2021 +0200

    x86/shadow: fix DO_UNSHADOW()
    
    When adding the HASH_CALLBACKS_CHECK() I failed to properly recognize
    the (somewhat unusually formatted) if() around the call to
    hash_domain_foreach()). Gcc 11 is absolutely right in pointing out the
    apparently misleading indentation. Besides adding the missing braces,
    also adjust the two oddly formatted if()-s in the macro.
    
    Fixes: 90629587e16e ("x86/shadow: replace stale literal numbers in hash_{vcpu,domain}_foreach()")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
    Reviewed-by: Tim Deegan <tim@xen.org>
---
 xen/arch/x86/mm/shadow/common.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/xen/arch/x86/mm/shadow/common.c b/xen/arch/x86/mm/shadow/common.c
index b060ebcb72..6db538502d 100644
--- a/xen/arch/x86/mm/shadow/common.c
+++ b/xen/arch/x86/mm/shadow/common.c
@@ -2220,8 +2220,8 @@ void sh_remove_shadows(struct domain *d, mfn_t gmfn, int fast, int all)
      */
 #define DO_UNSHADOW(_type) do {                                         \
     t = (_type);                                                        \
-    if( !(pg->count_info & PGC_page_table)                              \
-        || !(pg->shadow_flags & (1 << t)) )                             \
+    if ( !(pg->count_info & PGC_page_table) ||                          \
+         !(pg->shadow_flags & (1 << t)) )                               \
         break;                                                          \
     smfn = shadow_hash_lookup(d, mfn_x(gmfn), t);                       \
     if ( unlikely(!mfn_valid(smfn)) )                                   \
@@ -2235,11 +2235,13 @@ void sh_remove_shadows(struct domain *d, mfn_t gmfn, int fast, int all)
         sh_unpin(d, smfn);                                              \
     else if ( sh_type_has_up_pointer(d, t) )                            \
         sh_remove_shadow_via_pointer(d, smfn);                          \
-    if( !fast                                                           \
-        && (pg->count_info & PGC_page_table)                            \
-        && (pg->shadow_flags & (1 << t)) )                              \
+    if ( !fast &&                                                       \
+         (pg->count_info & PGC_page_table) &&                           \
+         (pg->shadow_flags & (1 << t)) )                                \
+    {                                                                   \
         HASH_CALLBACKS_CHECK(SHF_page_type_mask);                       \
         hash_domain_foreach(d, masks[t], callbacks, smfn);              \
+    }                                                                   \
 } while (0)
 
     DO_UNSHADOW(SH_type_l2_32_shadow);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue May 25 09:33:14 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 25 May 2021 09:33:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.132132.246574 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1llTQw-0007mF-0o; Tue, 25 May 2021 09:33:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 132132.246574; Tue, 25 May 2021 09:33:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1llTQv-0007m6-Tr; Tue, 25 May 2021 09:33:05 +0000
Received: by outflank-mailman (input) for mailman id 132132;
 Tue, 25 May 2021 09:33:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1llTQu-0007m0-OD
 for xen-changelog@lists.xenproject.org; Tue, 25 May 2021 09:33:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1llTQu-0006rp-Lm
 for xen-changelog@lists.xenproject.org; Tue, 25 May 2021 09:33:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1llTQu-0002yN-Kj
 for xen-changelog@lists.xenproject.org; Tue, 25 May 2021 09:33:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=MYCarY83d9I8BaePa88ruPrAC2zp9lcdrt19SOJNkUM=; b=cxMa8yCWgfLR3dVsPABSqoGdiY
	w9GhB8tCQSjAbn2kEjZjSuDCfMH6OLUh884sZ673CwmfdQaIUATyy7XX6151Cww9bnoWUZnyacqm4
	93LPYGHO3iyfE+dR4gPueTo+0R6OnJ9dLTLp4D8d39Sioo3oBTn3NBRoF3ALPdK0ZamE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] automation: Add container for riscv64 builds
Message-Id: <E1llTQu-0002yN-Kj@xenbits.xenproject.org>
Date: Tue, 25 May 2021 09:33:04 +0000

commit 3092006fc4e096a7eebb8042cb76d82b09ccece4
Author:     Connor Davis <connojdavis@gmail.com>
AuthorDate: Mon May 24 08:34:28 2021 -0600
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue May 25 10:25:39 2021 +0100

    automation: Add container for riscv64 builds
    
    Add a container for cross-compiling xen to riscv64.
    This just includes the cross-compiler and necessary packages for
    building xen itself (packages for tools, stubdoms, etc., can be
    added later).
    
    Signed-off-by: Connor Davis <connojdavis@gmail.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 automation/build/archlinux/riscv64.dockerfile | 19 +++++++++++++++++++
 automation/scripts/containerize               |  1 +
 2 files changed, 20 insertions(+)

diff --git a/automation/build/archlinux/riscv64.dockerfile b/automation/build/archlinux/riscv64.dockerfile
new file mode 100644
index 0000000000..ff8b2b955d
--- /dev/null
+++ b/automation/build/archlinux/riscv64.dockerfile
@@ -0,0 +1,19 @@
+FROM archlinux
+LABEL maintainer.name="The Xen Project" \
+      maintainer.email="xen-devel@lists.xenproject.org"
+
+# Packages needed for the build
+RUN pacman --noconfirm --needed -Syu \
+    base-devel \
+    git \
+    inetutils \
+    riscv64-linux-gnu-binutils \
+    riscv64-linux-gnu-gcc \
+    riscv64-linux-gnu-glibc
+
+# Add compiler path
+ENV CROSS_COMPILE=riscv64-linux-gnu-
+
+RUN useradd --create-home user
+USER user
+WORKDIR /build
diff --git a/automation/scripts/containerize b/automation/scripts/containerize
index b7c81559fb..59edf0ba40 100755
--- a/automation/scripts/containerize
+++ b/automation/scripts/containerize
@@ -26,6 +26,7 @@ BASE="registry.gitlab.com/xen-project/xen"
 case "_${CONTAINER}" in
     _alpine) CONTAINER="${BASE}/alpine:3.12" ;;
     _archlinux|_arch) CONTAINER="${BASE}/archlinux:current" ;;
+    _riscv64) CONTAINER="${BASE}/archlinux:riscv64" ;;
     _centos7) CONTAINER="${BASE}/centos:7" ;;
     _centos72) CONTAINER="${BASE}/centos:7.2" ;;
     _fedora) CONTAINER="${BASE}/fedora:29";;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed May 26 07:44:14 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 26 May 2021 07:44:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.132367.246926 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lloCz-0000bB-SP; Wed, 26 May 2021 07:44:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 132367.246926; Wed, 26 May 2021 07:44:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lloCz-0000b3-OD; Wed, 26 May 2021 07:44:05 +0000
Received: by outflank-mailman (input) for mailman id 132367;
 Wed, 26 May 2021 07:44:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lloCy-0000aC-Pz
 for xen-changelog@lists.xenproject.org; Wed, 26 May 2021 07:44:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lloCy-0002sH-Mt
 for xen-changelog@lists.xenproject.org; Wed, 26 May 2021 07:44:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lloCy-0001gQ-Lt
 for xen-changelog@lists.xenproject.org; Wed, 26 May 2021 07:44:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=YH9Ms1QfssADrKiL9WAz0tP08NJp1gC4h/mZpxdD844=; b=J1CVcNbMdpMPp7YyzTEy3HmtNm
	8s0HOnw2sbTHpm/QtVMnl69WvmUQDicWlRD6fROkOamwWq5sdGoI5HVJ/hlUQR9TTLVtdvJqup5in
	At5SZgvT1Sp9p5Heh6BSxZkC1QQZLg1IIXFkOOFA86/qpXIrL3+7YrHpjqeKNQD1CA9s=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/guest: fix build when HVM and !PV32
Message-Id: <E1lloCy-0001gQ-Lt@xenbits.xenproject.org>
Date: Wed, 26 May 2021 07:44:04 +0000

commit 3673e9ba77bb71a36e9917bf1e487c40dc425c92
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed May 26 09:33:02 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed May 26 09:33:02 2021 +0200

    x86/guest: fix build when HVM and !PV32
    
    The commit referenced below still wasn't careful enough - with COMPAT we
    will have a compat_handle_okay() visible already, which we first need to
    get rid of.
    
    Fixes: bd1e7b47bac0 ("x86/shim: fix build when !PV32")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/pv/shim.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/xen/arch/x86/pv/shim.c b/xen/arch/x86/pv/shim.c
index 8164a0fbde..d9704121a7 100644
--- a/xen/arch/x86/pv/shim.c
+++ b/xen/arch/x86/pv/shim.c
@@ -679,6 +679,7 @@ void pv_shim_inject_evtchn(unsigned int port)
 # include <compat/grant_table.h>
 #else
 # define compat_gnttab_setup_table gnttab_setup_table
+# undef compat_handle_okay
 # define compat_handle_okay guest_handle_okay
 #endif
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed May 26 07:44:15 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 26 May 2021 07:44:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.132368.246928 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lloD9-0000dk-Sr; Wed, 26 May 2021 07:44:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 132368.246928; Wed, 26 May 2021 07:44:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lloD9-0000dc-Pv; Wed, 26 May 2021 07:44:15 +0000
Received: by outflank-mailman (input) for mailman id 132368;
 Wed, 26 May 2021 07:44:14 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lloD8-0000dQ-R1
 for xen-changelog@lists.xenproject.org; Wed, 26 May 2021 07:44:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lloD8-0002sb-Q6
 for xen-changelog@lists.xenproject.org; Wed, 26 May 2021 07:44:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lloD8-0001hI-P6
 for xen-changelog@lists.xenproject.org; Wed, 26 May 2021 07:44:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=l0cn/hFtjqujasORCyNPO/wLfqRAbbOkJbiD30DIg7E=; b=0MioGWW9cH/cfSGp9RElEc24CE
	KFtHpSFZ+U4ajTiw9O6BUuEBta7R2DLXg1UAKHSuhXLJVW9AjousUUB04JxGE55Anpn4bnznrQ14W
	gwOPPMR80Iu9FLbpySHYK10BrbVwoVc6vtg7THYQqzhSKiN+GAL4AJNEgMCmU/ZPXePI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] firmware/shim: update linkfarm exclusions
Message-Id: <E1lloD8-0001hI-P6@xenbits.xenproject.org>
Date: Wed, 26 May 2021 07:44:14 +0000

commit 022da003747a7f4336f8c581fdf898a7d5cd47e4
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed May 26 09:34:07 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed May 26 09:34:07 2021 +0200

    firmware/shim: update linkfarm exclusions
    
    Some intermediate files weren't considered at all at the time. Also
    after its introduction, various changes to the build environment have
    rendered the exclusion sets stale. For example, we now have some .*.cmd
    files in the build tree. Combine all respective patterns into a single
    .* one, seeing that we don't have any actual source files matching this
    pattern in the tree. Add other patterns as well as individual files.
    Also introduce LINK_EXCLUDE_PATHS to deal with entire directories full
    of generated headers as well as a few specific files the names of which
    are too generic to list under LINK_EXCLUDES.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 tools/firmware/xen-dir/Makefile | 26 +++++++++++++++++++-------
 1 file changed, 19 insertions(+), 7 deletions(-)

diff --git a/tools/firmware/xen-dir/Makefile b/tools/firmware/xen-dir/Makefile
index 5413f86790..afc651f861 100644
--- a/tools/firmware/xen-dir/Makefile
+++ b/tools/firmware/xen-dir/Makefile
@@ -15,9 +15,19 @@ DEP_DIRS=$(foreach i, $(LINK_DIRS), $(XEN_ROOT)/$(i))
 DEP_FILES=$(foreach i, $(LINK_FILES), $(XEN_ROOT)/$(i))
 
 # Exclude some intermediate files and final build products
-LINK_EXCLUDES := '*.[isoa]' '.*.d' '.*.d2' '.config'
-LINK_EXCLUDES += '*.map' 'xen' 'xen.gz' 'xen.efi' 'xen-syms'
-LINK_EXCLUDES += '.*.tmp'
+LINK_EXCLUDES := '*.[isoa]' '*.bin' '*.chk' '*.lnk' '*.gz' '.*'
+LINK_EXCLUDES += lexer.lex.? parser.tab.? conf
+LINK_EXCLUDES += asm-offsets.h asm-macros.h compile.h '*-autogen.h'
+LINK_EXCLUDES += mkelf32 mkreloc symbols config_data.S xen.lds efi.lds
+LINK_EXCLUDES += '*.map' xen xen.gz xen.efi xen-syms check.efi
+
+# To exclude full subtrees or individual files of not sufficiently specific
+# names, regular expressions are used:
+LINK_EXCLUDE_PATHS := xen/include/compat/.*
+LINK_EXCLUDE_PATHS += xen/include/config/.*
+LINK_EXCLUDE_PATHS += xen/include/generated/.*
+LINK_EXCLUDE_PATHS += xen/arch/x86/boot/reloc[.]S
+LINK_EXCLUDE_PATHS += xen/arch/x86/boot/cmdline[.]S
 
 # This is all a giant mess and doesn't really work.
 #
@@ -32,9 +42,10 @@ LINK_EXCLUDES += '.*.tmp'
 # support easy development of the shim, but has a side effect of clobbering
 # the already-built shim.
 #
-# $(LINK_EXCLUDES) should be set such that a parallel build of shim and xen/
-# doesn't cause a subsequent `make install` to decide to regenerate the
-# linkfarm.  This means that all final build artefacts must be excluded.
+# $(LINK_EXCLUDES) and $(LINK_EXCLUDE_DIRS) should be set such that a parallel
+# build of shim and xen/ doesn't cause a subsequent `make install` to decide to
+# regenerate the linkfarm.  This means that all intermediate and final build
+# artefacts must be excluded.
 linkfarm.stamp: $(DEP_DIRS) $(DEP_FILES) FORCE
 	mkdir -p $(D)
 	rm -f linkfarm.stamp.tmp
@@ -46,7 +57,8 @@ linkfarm.stamp: $(DEP_DIRS) $(DEP_FILES) FORCE
 			sed 's,^$(XEN_ROOT)/$(d)/,,g' | xargs mkdir -p .);) \
 	$(foreach d, $(LINK_DIRS), \
 		(cd $(XEN_ROOT); \
-		 find $(d) ! -type l -type f $(addprefix ! -name ,$(LINK_EXCLUDES))) \
+		 find $(d) ! -type l -type f $(addprefix ! -name ,$(LINK_EXCLUDES)) \
+		 | grep -v $(patsubst %,-e '^%$$',$(LINK_EXCLUDE_PATHS))) \
 		 >> linkfarm.stamp.tmp ; ) \
 	$(foreach f, $(LINK_FILES), \
 		echo $(f) >> linkfarm.stamp.tmp ;)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed May 26 07:44:25 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 26 May 2021 07:44:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.132369.246932 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lloDJ-0000gs-UP; Wed, 26 May 2021 07:44:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 132369.246932; Wed, 26 May 2021 07:44:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lloDJ-0000gk-RN; Wed, 26 May 2021 07:44:25 +0000
Received: by outflank-mailman (input) for mailman id 132369;
 Wed, 26 May 2021 07:44:24 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lloDI-0000gO-U0
 for xen-changelog@lists.xenproject.org; Wed, 26 May 2021 07:44:24 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lloDI-0002so-T5
 for xen-changelog@lists.xenproject.org; Wed, 26 May 2021 07:44:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lloDI-0001iL-SC
 for xen-changelog@lists.xenproject.org; Wed, 26 May 2021 07:44:24 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=kE10lFcUsotl53GO2jkH2OJGlVxJtSxJjYvF7XNRDYY=; b=kvcvNft6PWVJ5l4yECjhsZ2J52
	rj7fejUBfEw8irs+MQH15F6zfqy9HzTDJLuqqJxPwdtc2z40HH9jYSmZbm2kEvaN4VBX3ew+NBVBQ
	46lEqbFXZv7ZeUKqqEgYLIGyjBYOUS9NJp5f6UU1D0sMOYIH+6KmUgUujbCOGFusH4rQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] firmware/shim: drop XEN_CONFIG_EXPERT uses
Message-Id: <E1lloDI-0001iL-SC@xenbits.xenproject.org>
Date: Wed, 26 May 2021 07:44:24 +0000

commit 7793d19bac84cb84d919035faa9aa638f0a33370
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed May 26 09:34:37 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed May 26 09:34:37 2021 +0200

    firmware/shim: drop XEN_CONFIG_EXPERT uses
    
    As of commit d155e4aef35c ("xen: Allow EXPERT mode to be selected from
    the menuconfig directly") EXPERT is a regular config option (which the
    shim default config also enables).
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <rogerpau@citrix.com>
---
 tools/firmware/xen-dir/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/firmware/xen-dir/Makefile b/tools/firmware/xen-dir/Makefile
index afc651f861..6f5e208ab4 100644
--- a/tools/firmware/xen-dir/Makefile
+++ b/tools/firmware/xen-dir/Makefile
@@ -74,10 +74,10 @@ $(D): linkfarm.stamp
 	$(MAKE) -C $(D)/xen distclean
 
 $(D)/xen/.config: $(D)
-	$(MAKE) -C $(@D) KBUILD_DEFCONFIG=pvshim_defconfig XEN_CONFIG_EXPERT=y defconfig
+	$(MAKE) -C $(@D) KBUILD_DEFCONFIG=pvshim_defconfig defconfig
 
 xen-shim: $(D)/xen/.config
-	$(MAKE) -C $(<D) build XEN_CONFIG_EXPERT=y
+	$(MAKE) -C $(<D) build
 	ln -sf $(D)/xen/xen $@
 	ln -sf $(D)/xen/xen-syms $@-syms
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed May 26 15:11:12 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 26 May 2021 15:11:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.132572.247229 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1llvBa-00042c-8d; Wed, 26 May 2021 15:11:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 132572.247229; Wed, 26 May 2021 15:11:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1llvBa-00042U-5h; Wed, 26 May 2021 15:11:06 +0000
Received: by outflank-mailman (input) for mailman id 132572;
 Wed, 26 May 2021 15:11:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1llvBZ-00042M-6c
 for xen-changelog@lists.xenproject.org; Wed, 26 May 2021 15:11:05 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1llvBZ-000378-3H
 for xen-changelog@lists.xenproject.org; Wed, 26 May 2021 15:11:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1llvBZ-0006Zv-2P
 for xen-changelog@lists.xenproject.org; Wed, 26 May 2021 15:11:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=9pxfEHjBzaaRlqyyZ2f5tmS0Nz9D7qbyIPe2blNHFNU=; b=LdYjSywWFGgjWKsmyDnFeHqCCn
	Gmy3h2v5qAA3HIlOfC8MnjjaMLHBQGwR0L+Dk4A/z1W/a0bAy4oW8irz2Kj/tmobuNK+bD4dxk61N
	/ipveM8tHn0N2X0N8qF6I/OpOV6UsgV/29qt8XZ5zNq5WZ+2t91fRmzcU0FQkDjD7pWU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/char: console: Use const whenever we point to literal strings
Message-Id: <E1llvBZ-0006Zv-2P@xenbits.xenproject.org>
Date: Wed, 26 May 2021 15:11:05 +0000

commit b0a5b1735c704ec2055e52587a7c5b94370911c0
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Wed May 26 16:01:32 2021 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Wed May 26 16:01:32 2021 +0100

    xen/char: console: Use const whenever we point to literal strings
    
    Literal strings are not meant to be modified. So we should use const
    char * rather than char * when we want to store a pointer to them.
    
    The array should also not be modified at all and is only used by
    xenlog_update_val(). So take the opportunity to add an extra const and
    move the definition in the function.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
---
 xen/drivers/char/console.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/xen/drivers/char/console.c b/xen/drivers/char/console.c
index 2358375170..7d0a603d03 100644
--- a/xen/drivers/char/console.c
+++ b/xen/drivers/char/console.c
@@ -168,10 +168,11 @@ static int parse_guest_loglvl(const char *s);
 static char xenlog_val[LOGLVL_VAL_SZ];
 static char xenlog_guest_val[LOGLVL_VAL_SZ];
 
-static char *lvl2opt[] = { "none", "error", "warning", "info", "all" };
-
 static void xenlog_update_val(int lower, int upper, char *val)
 {
+    static const char * const lvl2opt[] =
+        { "none", "error", "warning", "info", "all" };
+
     snprintf(val, LOGLVL_VAL_SZ, "%s/%s", lvl2opt[lower], lvl2opt[upper]);
 }
 
@@ -262,7 +263,7 @@ static int parse_guest_loglvl(const char *s)
     return ret;
 }
 
-static char *loglvl_str(int lvl)
+static const char *loglvl_str(int lvl)
 {
     switch ( lvl )
     {
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed May 26 15:11:16 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 26 May 2021 15:11:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.132573.247233 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1llvBk-00045M-AD; Wed, 26 May 2021 15:11:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 132573.247233; Wed, 26 May 2021 15:11:16 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1llvBk-00045E-7D; Wed, 26 May 2021 15:11:16 +0000
Received: by outflank-mailman (input) for mailman id 132573;
 Wed, 26 May 2021 15:11:15 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1llvBj-000452-7X
 for xen-changelog@lists.xenproject.org; Wed, 26 May 2021 15:11:15 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1llvBj-00037K-6j
 for xen-changelog@lists.xenproject.org; Wed, 26 May 2021 15:11:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1llvBj-0006al-5J
 for xen-changelog@lists.xenproject.org; Wed, 26 May 2021 15:11:15 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=84CvrRo7KhBcJTFQyR+TMiqAOCdgzKG77dUY6tPUAs0=; b=IMeLjsnMpEBAbxR/hub3s5rEbT
	HdJzvpJUm2q8iY/JUm1IPyMUOpJjwF2e/fWkmBJCqP1bpGY9jNMBvN7fpQ9dIZI4bBCZ2f/bEO7BU
	BNAkwWqREeKjioTcBRklZT6d6XRz0SzGjcAnTVhAHIMv+pKO1Okq5IJW4K9STViQnLSs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/console: Use const whenever we point to literal strings
Message-Id: <E1llvBj-0006al-5J@xenbits.xenproject.org>
Date: Wed, 26 May 2021 15:11:15 +0000

commit 3beb2ee6be1d15f9f3c2bb89160803da21dc7e20
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Wed May 26 16:01:51 2021 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Wed May 26 16:01:51 2021 +0100

    tools/console: Use const whenever we point to literal strings
    
    Literal strings are not meant to be modified. So we should use const
    char * rather than char * when we want to store a pointer to them.
    
    Take the opportunity to remove the cast (char *) in console_init(). It
    is unnecessary and will remove the const.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Acked-by: Wei Liu <wl@xen.org>
    Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
---
 tools/console/client/main.c |  4 ++--
 tools/console/daemon/io.c   | 15 ++++++++-------
 2 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/tools/console/client/main.c b/tools/console/client/main.c
index 088be28dff..80157be421 100644
--- a/tools/console/client/main.c
+++ b/tools/console/client/main.c
@@ -325,7 +325,7 @@ int main(int argc, char **argv)
 {
 	struct termios attr;
 	int domid;
-	char *sopt = "hn:";
+	const char *sopt = "hn:";
 	int ch;
 	unsigned int num = 0;
 	int opt_ind=0;
@@ -345,7 +345,7 @@ int main(int argc, char **argv)
 	char *end;
 	console_type type = CONSOLE_INVAL;
 	bool interactive = 0;
-	char *console_names = "serial, pv, vuart";
+	const char *console_names = "serial, pv, vuart";
 
 	while((ch = getopt_long(argc, argv, sopt, lopt, &opt_ind)) != -1) {
 		switch(ch) {
diff --git a/tools/console/daemon/io.c b/tools/console/daemon/io.c
index 4af27ffc5d..200b575d76 100644
--- a/tools/console/daemon/io.c
+++ b/tools/console/daemon/io.c
@@ -87,14 +87,14 @@ struct buffer {
 };
 
 struct console {
-	char *ttyname;
+	const char *ttyname;
 	int master_fd;
 	int master_pollfd_idx;
 	int slave_fd;
 	int log_fd;
 	struct buffer buffer;
 	char *xspath;
-	char *log_suffix;
+	const char *log_suffix;
 	int ring_ref;
 	xenevtchn_handle *xce_handle;
 	int xce_pollfd_idx;
@@ -109,9 +109,9 @@ struct console {
 };
 
 struct console_type {
-	char *xsname;
-	char *ttyname;
-	char *log_suffix;
+	const char *xsname;
+	const char *ttyname;
+	const char *log_suffix;
 	bool optional;
 	bool use_gnttab;
 };
@@ -813,7 +813,8 @@ static int console_init(struct console *con, struct domain *dom, void **data)
 	int err = -1;
 	struct timespec ts;
 	struct console_type **con_type = (struct console_type **)data;
-	char *xsname, *xspath;
+	const char *xsname;
+	char *xspath;
 
 	if (clock_gettime(CLOCK_MONOTONIC, &ts) < 0) {
 		dolog(LOG_ERR, "Cannot get time of day %s:%s:L%d",
@@ -835,7 +836,7 @@ static int console_init(struct console *con, struct domain *dom, void **data)
 	con->log_suffix = (*con_type)->log_suffix;
 	con->optional = (*con_type)->optional;
 	con->use_gnttab = (*con_type)->use_gnttab;
-	xsname = (char *)(*con_type)->xsname;
+	xsname = (*con_type)->xsname;
 	xspath = xs_get_domain_path(xs, dom->domid);
 	s = realloc(xspath, strlen(xspath) +
 		    strlen(xsname) + 1);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed May 26 15:44:10 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 26 May 2021 15:44:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.132616.247297 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1llvhW-0001Sl-4Q; Wed, 26 May 2021 15:44:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 132616.247297; Wed, 26 May 2021 15:44:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1llvhW-0001Sd-01; Wed, 26 May 2021 15:44:06 +0000
Received: by outflank-mailman (input) for mailman id 132616;
 Wed, 26 May 2021 15:44:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1llvhU-0001Rm-Mj
 for xen-changelog@lists.xenproject.org; Wed, 26 May 2021 15:44:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1llvhU-0003fl-H9
 for xen-changelog@lists.xenproject.org; Wed, 26 May 2021 15:44:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1llvhU-0000j7-GB
 for xen-changelog@lists.xenproject.org; Wed, 26 May 2021 15:44:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=kcgVFpPW7qKV0GjZmclSrfT/NusHVXppLRwYTcN6si8=; b=T428GpvmasEP/3VJctYeiKfWlN
	N0dQVXRYrmB0wsM6fO+WBOqHXxjRbvEiJ22HFPRe/lQTA172CIhaA8CuyMGzwqrNvuU/fVpbJ6KYT
	/VmlQ0ZpQw+/PPayczzsR7OGKrdPdIMVPcbygCWDGiaN5IeMJxiG5f+SGv1TZajw30pY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/xenstored: Remove unused parameter in check_domains()
Message-Id: <E1llvhU-0000j7-GB@xenbits.xenproject.org>
Date: Wed, 26 May 2021 15:44:04 +0000

commit 7c110dd335a17be52549dc4b9dfbfba8165ade40
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Wed May 26 16:35:53 2021 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Wed May 26 16:35:53 2021 +0100

    tools/xenstored: Remove unused parameter in check_domains()
    
    The parameter of check_domains() is not used within the function. In fact,
    this was a left over of the original implementation as the version merged
    doesn't need to know whether we are restoring.
    
    So remove it.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
---
 tools/xenstore/xenstored_control.c | 2 +-
 tools/xenstore/xenstored_domain.c  | 4 ++--
 tools/xenstore/xenstored_domain.h  | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/xenstore/xenstored_control.c b/tools/xenstore/xenstored_control.c
index 52d4817679..2c63ba7ead 100644
--- a/tools/xenstore/xenstored_control.c
+++ b/tools/xenstore/xenstored_control.c
@@ -589,7 +589,7 @@ void lu_read_state(void)
 	 * have died while we were live-updating. So check all the domains are
 	 * still alive.
 	 */
-	check_domains(true);
+	check_domains();
 }
 
 static const char *lu_activate_binary(const void *ctx)
diff --git a/tools/xenstore/xenstored_domain.c b/tools/xenstore/xenstored_domain.c
index 708bf68af0..322b0dbca4 100644
--- a/tools/xenstore/xenstored_domain.c
+++ b/tools/xenstore/xenstored_domain.c
@@ -227,7 +227,7 @@ static bool get_domain_info(unsigned int domid, xc_dominfo_t *dominfo)
 	       dominfo->domid == domid;
 }
 
-void check_domains(bool restore)
+void check_domains(void)
 {
 	xc_dominfo_t dominfo;
 	struct domain *domain;
@@ -284,7 +284,7 @@ void handle_event(void)
 		barf_perror("Failed to read from event fd");
 
 	if (port == virq_port)
-		check_domains(false);
+		check_domains();
 
 	if (xenevtchn_unmask(xce_handle, port) == -1)
 		barf_perror("Failed to write to event fd");
diff --git a/tools/xenstore/xenstored_domain.h b/tools/xenstore/xenstored_domain.h
index dc97591713..cc5147d7e7 100644
--- a/tools/xenstore/xenstored_domain.h
+++ b/tools/xenstore/xenstored_domain.h
@@ -21,7 +21,7 @@
 
 void handle_event(void);
 
-void check_domains(bool restore);
+void check_domains(void);
 
 /* domid, mfn, eventchn, path */
 int do_introduce(struct connection *conn, struct buffered_data *in);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed May 26 19:22:11 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 26 May 2021 19:22:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.132715.247448 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1llz6S-0003iU-9W; Wed, 26 May 2021 19:22:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 132715.247448; Wed, 26 May 2021 19:22:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1llz6S-0003iM-6W; Wed, 26 May 2021 19:22:04 +0000
Received: by outflank-mailman (input) for mailman id 132715;
 Wed, 26 May 2021 19:22:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1llz6Q-0003iG-RE
 for xen-changelog@lists.xenproject.org; Wed, 26 May 2021 19:22:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1llz6Q-0007xi-PZ
 for xen-changelog@lists.xenproject.org; Wed, 26 May 2021 19:22:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1llz6Q-0005ih-Oi
 for xen-changelog@lists.xenproject.org; Wed, 26 May 2021 19:22:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=GCWfF5Rxh5bRIA8sOFp8feZOJ7EKqO8vWmNBlXpmkTQ=; b=J0/czDEZ4GDnJ76NEPFyLMkixJ
	/2KVXgt2ZKTAGGfxeFFvBaGWetoGuxxU94uuWYAbJePVa0aBduZYKmn1EM73z9hY+V4+f4GBrqLLs
	LIFhhQ32B1b4VwL90XkeYJPNv2ZcHAcEz5IiVirIkywrZZZOBlT5FOr7NWzutHo0R+2E=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/shadow: fix DO_UNSHADOW()
Message-Id: <E1llz6Q-0005ih-Oi@xenbits.xenproject.org>
Date: Wed, 26 May 2021 19:22:02 +0000

commit 81acb1d7bdd5b1bf9c3422dcfeda616db2405d6f
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue May 25 09:08:43 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue May 25 09:08:43 2021 +0200

    x86/shadow: fix DO_UNSHADOW()
    
    When adding the HASH_CALLBACKS_CHECK() I failed to properly recognize
    the (somewhat unusually formatted) if() around the call to
    hash_domain_foreach()). Gcc 11 is absolutely right in pointing out the
    apparently misleading indentation. Besides adding the missing braces,
    also adjust the two oddly formatted if()-s in the macro.
    
    Fixes: 90629587e16e ("x86/shadow: replace stale literal numbers in hash_{vcpu,domain}_foreach()")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
    Reviewed-by: Tim Deegan <tim@xen.org>
---
 xen/arch/x86/mm/shadow/common.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/xen/arch/x86/mm/shadow/common.c b/xen/arch/x86/mm/shadow/common.c
index b060ebcb72..6db538502d 100644
--- a/xen/arch/x86/mm/shadow/common.c
+++ b/xen/arch/x86/mm/shadow/common.c
@@ -2220,8 +2220,8 @@ void sh_remove_shadows(struct domain *d, mfn_t gmfn, int fast, int all)
      */
 #define DO_UNSHADOW(_type) do {                                         \
     t = (_type);                                                        \
-    if( !(pg->count_info & PGC_page_table)                              \
-        || !(pg->shadow_flags & (1 << t)) )                             \
+    if ( !(pg->count_info & PGC_page_table) ||                          \
+         !(pg->shadow_flags & (1 << t)) )                               \
         break;                                                          \
     smfn = shadow_hash_lookup(d, mfn_x(gmfn), t);                       \
     if ( unlikely(!mfn_valid(smfn)) )                                   \
@@ -2235,11 +2235,13 @@ void sh_remove_shadows(struct domain *d, mfn_t gmfn, int fast, int all)
         sh_unpin(d, smfn);                                              \
     else if ( sh_type_has_up_pointer(d, t) )                            \
         sh_remove_shadow_via_pointer(d, smfn);                          \
-    if( !fast                                                           \
-        && (pg->count_info & PGC_page_table)                            \
-        && (pg->shadow_flags & (1 << t)) )                              \
+    if ( !fast &&                                                       \
+         (pg->count_info & PGC_page_table) &&                           \
+         (pg->shadow_flags & (1 << t)) )                                \
+    {                                                                   \
         HASH_CALLBACKS_CHECK(SHF_page_type_mask);                       \
         hash_domain_foreach(d, masks[t], callbacks, smfn);              \
+    }                                                                   \
 } while (0)
 
     DO_UNSHADOW(SH_type_l2_32_shadow);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed May 26 19:22:13 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 26 May 2021 19:22:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.132716.247452 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1llz6b-0003kD-Au; Wed, 26 May 2021 19:22:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 132716.247452; Wed, 26 May 2021 19:22:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1llz6b-0003k5-87; Wed, 26 May 2021 19:22:13 +0000
Received: by outflank-mailman (input) for mailman id 132716;
 Wed, 26 May 2021 19:22:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1llz6a-0003jz-TG
 for xen-changelog@lists.xenproject.org; Wed, 26 May 2021 19:22:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1llz6a-0007xm-SR
 for xen-changelog@lists.xenproject.org; Wed, 26 May 2021 19:22:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1llz6a-0005jO-RZ
 for xen-changelog@lists.xenproject.org; Wed, 26 May 2021 19:22:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=FwNpyUnujfsbWcy8jvXEqhDwVRAoz28jNDDOXeg2zkY=; b=XEJ1tj5wyd6ZCDBz5lfgtDILvH
	G+8vV+g0hQVJWZZ2V53JUIZUylVIboGhAR8zYLjn6jmpX7qv30eV3SY3DoflVNw3Jiwc+SaGKKL8U
	DAns4aRcbRT63JRZJL73DQcYC1UqiYd0+xLR/kPRhWdo43IuNg76RMiGsdHEKVFYah74=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation: Add container for riscv64 builds
Message-Id: <E1llz6a-0005jO-RZ@xenbits.xenproject.org>
Date: Wed, 26 May 2021 19:22:12 +0000

commit 3092006fc4e096a7eebb8042cb76d82b09ccece4
Author:     Connor Davis <connojdavis@gmail.com>
AuthorDate: Mon May 24 08:34:28 2021 -0600
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue May 25 10:25:39 2021 +0100

    automation: Add container for riscv64 builds
    
    Add a container for cross-compiling xen to riscv64.
    This just includes the cross-compiler and necessary packages for
    building xen itself (packages for tools, stubdoms, etc., can be
    added later).
    
    Signed-off-by: Connor Davis <connojdavis@gmail.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 automation/build/archlinux/riscv64.dockerfile | 19 +++++++++++++++++++
 automation/scripts/containerize               |  1 +
 2 files changed, 20 insertions(+)

diff --git a/automation/build/archlinux/riscv64.dockerfile b/automation/build/archlinux/riscv64.dockerfile
new file mode 100644
index 0000000000..ff8b2b955d
--- /dev/null
+++ b/automation/build/archlinux/riscv64.dockerfile
@@ -0,0 +1,19 @@
+FROM archlinux
+LABEL maintainer.name="The Xen Project" \
+      maintainer.email="xen-devel@lists.xenproject.org"
+
+# Packages needed for the build
+RUN pacman --noconfirm --needed -Syu \
+    base-devel \
+    git \
+    inetutils \
+    riscv64-linux-gnu-binutils \
+    riscv64-linux-gnu-gcc \
+    riscv64-linux-gnu-glibc
+
+# Add compiler path
+ENV CROSS_COMPILE=riscv64-linux-gnu-
+
+RUN useradd --create-home user
+USER user
+WORKDIR /build
diff --git a/automation/scripts/containerize b/automation/scripts/containerize
index b7c81559fb..59edf0ba40 100755
--- a/automation/scripts/containerize
+++ b/automation/scripts/containerize
@@ -26,6 +26,7 @@ BASE="registry.gitlab.com/xen-project/xen"
 case "_${CONTAINER}" in
     _alpine) CONTAINER="${BASE}/alpine:3.12" ;;
     _archlinux|_arch) CONTAINER="${BASE}/archlinux:current" ;;
+    _riscv64) CONTAINER="${BASE}/archlinux:riscv64" ;;
     _centos7) CONTAINER="${BASE}/centos:7" ;;
     _centos72) CONTAINER="${BASE}/centos:7.2" ;;
     _fedora) CONTAINER="${BASE}/fedora:29";;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu May 27 12:44:15 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 May 2021 12:44:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.133173.248275 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lmFMs-00025o-2x; Thu, 27 May 2021 12:44:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 133173.248275; Thu, 27 May 2021 12:44:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lmFMr-00025f-VE; Thu, 27 May 2021 12:44:05 +0000
Received: by outflank-mailman (input) for mailman id 133173;
 Thu, 27 May 2021 12:44:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lmFMr-00024o-EB
 for xen-changelog@lists.xenproject.org; Thu, 27 May 2021 12:44:05 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lmFMr-0007i5-Cm
 for xen-changelog@lists.xenproject.org; Thu, 27 May 2021 12:44:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lmFMr-0007o2-Bm
 for xen-changelog@lists.xenproject.org; Thu, 27 May 2021 12:44:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=+koGjdoDzTC34ZxKbRGfhfjLdHg2GwbKAgsb2auX4uk=; b=ZskbiOzsKrqAoxzv1cBsSJhBOo
	UTOgRGvd0uKwABVMTxK4+eqdTmrR8BKlQqg1ujrv1nT/9qqlzGr0DHaSlMVJKROfyaamgZwoNxL3U
	Hz5Nvf5atD2uCz4cDSJZY472LG9rHwufvkGOH30mnEYV684Lo6Vh10QEl3SX6OT0mrYM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] firmware/shim: UNSUPPORTED=n
Message-Id: <E1lmFMr-0007o2-Bm@xenbits.xenproject.org>
Date: Thu, 27 May 2021 12:44:05 +0000

commit b509d4a688d80e802ff580990288ef5e17859df6
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu May 27 14:39:33 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu May 27 14:39:33 2021 +0200

    firmware/shim: UNSUPPORTED=n
    
    We shouldn't default to include any unsupported code in the shim. Mark
    the setting as off, replacing the ARGO specification. This points out
    anomalies with the scheduler configuration: Unsupported schedulers
    better don't default to Y in release builds (like is already the case
    for ARINC653). Without at least the SCHED_NULL adjustments, the shim
    would suddenly build with RTDS as its default scheduler.
    
    As a result, the SCHED_NULL setting can also be dropped from defconfig.
    
    Clearly with the shim defaulting to it, SCHED_NULL must be supported at
    least there.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Dario Faggioli <dfaggioli@suse.com>
---
 SUPPORT.md                            | 3 ++-
 xen/arch/x86/configs/pvshim_defconfig | 3 +--
 xen/common/sched/Kconfig              | 5 +++--
 3 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/SUPPORT.md b/SUPPORT.md
index d0d4fc6f4f..7a53635c9e 100644
--- a/SUPPORT.md
+++ b/SUPPORT.md
@@ -351,9 +351,10 @@ Currently only single-vcpu domains are supported.
 A very simple, very static scheduling policy
 that always schedules the same vCPU(s) on the same pCPU(s).
 It is designed for maximum determinism and minimum overhead
-on embedded platforms.
+on embedded platforms and the x86 PV shim.
 
     Status: Experimental
+    Status, x86/shim: Supported
 
 ### NUMA scheduler affinity
 
diff --git a/xen/arch/x86/configs/pvshim_defconfig b/xen/arch/x86/configs/pvshim_defconfig
index cdf5776610..787376df5a 100644
--- a/xen/arch/x86/configs/pvshim_defconfig
+++ b/xen/arch/x86/configs/pvshim_defconfig
@@ -6,7 +6,6 @@ CONFIG_PV_SHIM=y
 CONFIG_PV_SHIM_EXCLUSIVE=y
 CONFIG_NR_CPUS=32
 CONFIG_EXPERT=y
-CONFIG_SCHED_NULL=y
 # Disable features not used by the PV shim
 # CONFIG_XEN_SHSTK is not set
 # CONFIG_GRANT_TABLE is not set
@@ -15,7 +14,7 @@ CONFIG_SCHED_NULL=y
 # CONFIG_KEXEC is not set
 # CONFIG_XENOPROF is not set
 # CONFIG_XSM is not set
-# CONFIG_ARGO is not set
+# CONFIG_UNSUPPORTED is not set
 # CONFIG_SCHED_CREDIT is not set
 # CONFIG_SCHED_CREDIT2 is not set
 # CONFIG_SCHED_RTDS is not set
diff --git a/xen/common/sched/Kconfig b/xen/common/sched/Kconfig
index 94c9e20139..3d9f9214b8 100644
--- a/xen/common/sched/Kconfig
+++ b/xen/common/sched/Kconfig
@@ -16,7 +16,7 @@ config SCHED_CREDIT2
 
 config SCHED_RTDS
 	bool "RTDS scheduler support (UNSUPPORTED)" if UNSUPPORTED
-	default y
+	default DEBUG
 	---help---
 	  The RTDS scheduler is a soft and firm real-time scheduler for
 	  multicore, targeted for embedded, automotive, graphics and gaming
@@ -31,7 +31,7 @@ config SCHED_ARINC653
 
 config SCHED_NULL
 	bool "Null scheduler support (UNSUPPORTED)" if UNSUPPORTED
-	default y
+	default PV_SHIM || DEBUG
 	---help---
 	  The null scheduler is a static, zero overhead scheduler,
 	  for when there always are less vCPUs than pCPUs, typically
@@ -39,6 +39,7 @@ config SCHED_NULL
 
 choice
 	prompt "Default Scheduler?"
+	default SCHED_NULL_DEFAULT if PV_SHIM_EXCLUSIVE
 	default SCHED_CREDIT2_DEFAULT
 
 	config SCHED_CREDIT_DEFAULT
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu May 27 12:44:16 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 May 2021 12:44:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.133174.248278 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lmFN2-00028S-3j; Thu, 27 May 2021 12:44:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 133174.248278; Thu, 27 May 2021 12:44:16 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lmFN2-00028I-0T; Thu, 27 May 2021 12:44:16 +0000
Received: by outflank-mailman (input) for mailman id 133174;
 Thu, 27 May 2021 12:44:15 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lmFN1-000288-HQ
 for xen-changelog@lists.xenproject.org; Thu, 27 May 2021 12:44:15 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lmFN1-0007iB-Ge
 for xen-changelog@lists.xenproject.org; Thu, 27 May 2021 12:44:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lmFN1-0007on-Fd
 for xen-changelog@lists.xenproject.org; Thu, 27 May 2021 12:44:15 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=caUaIRg1jb0F+KYf9HAH+xcTPTwpdpOtSJ9IOTpYovg=; b=N7EGevRykcGN3v8KICpqelR3sp
	TnqoEM4ndUTDDvpKVWcGUlEcxRZTbddzb85lOj52FRuD2Sn2pEAjxQ/otND9qKYNC08LqV23MsPi3
	nowe2+LET/+mayeZ9cQp75FoA2245O1Q7s7uBvdsHd2pJcQ71vyuuzEEEB5Q8XnooPRw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86: make hypervisor build with gcc11
Message-Id: <E1lmFN1-0007on-Fd@xenbits.xenproject.org>
Date: Thu, 27 May 2021 12:44:15 +0000

commit 722f59d38c710a940ab05e542a83020eb5546dea
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu May 27 14:40:29 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu May 27 14:40:29 2021 +0200

    x86: make hypervisor build with gcc11
    
    Gcc 11 looks to make incorrect assumptions about valid ranges that
    pointers may be used for addressing when they are derived from e.g. a
    plain constant. See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100680.
    
    Utilize RELOC_HIDE() to work around the issue, which for x86 manifests
    in at least
    - mpparse.c:efi_check_config(),
    - tboot.c:tboot_probe(),
    - tboot.c:tboot_gen_frametable_integrity(),
    - x86_emulate.c:x86_emulate() (at -O2 only).
    The last case is particularly odd not just because it only triggers at
    higher optimization levels, but also because it only affects one of at
    least three similar constructs. Various "note" diagnostics claim the
    valid index range to be [0, 2⁶³-1].
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Tested-by: Jason Andryuk <jandryuk@gmail.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 tools/tests/x86_emulator/x86-emulate.c | 7 +++++++
 xen/arch/x86/x86_emulate/x86_emulate.c | 2 +-
 xen/include/asm-x86/fixmap.h           | 2 +-
 xen/include/xen/compiler.h             | 6 ++++++
 xen/include/xen/pdx.h                  | 2 +-
 5 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/tools/tests/x86_emulator/x86-emulate.c b/tools/tests/x86_emulator/x86-emulate.c
index 07f892dbbb..ea286d6ad8 100644
--- a/tools/tests/x86_emulator/x86-emulate.c
+++ b/tools/tests/x86_emulator/x86-emulate.c
@@ -8,6 +8,13 @@
 
 #define ERR_PTR(val) NULL
 
+/* See gcc bug 100680, but here don't bother making this version dependent. */
+#define gcc11_wrap(x) ({                  \
+    unsigned long x_;                     \
+    __asm__ ( "" : "=g" (x_) : "0" (x) ); \
+    (typeof(x))x_;                        \
+})
+
 #define cpu_has_amd_erratum(nr) 0
 #define cpu_has_mpx false
 #define read_bndcfgu() 0
diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c
index c25d88d0d8..31fdec030c 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -726,7 +726,7 @@ union vex {
 #define copy_VEX(ptr, vex) ({ \
     if ( !mode_64bit() ) \
         (vex).reg |= 8; \
-    (ptr)[0 - PFX_BYTES] = ext < ext_8f08 ? 0xc4 : 0x8f; \
+    gcc11_wrap(ptr)[0 - PFX_BYTES] = ext < ext_8f08 ? 0xc4 : 0x8f; \
     (ptr)[1 - PFX_BYTES] = (vex).raw[0]; \
     (ptr)[2 - PFX_BYTES] = (vex).raw[1]; \
     container_of((ptr) + 1 - PFX_BYTES, typeof(vex), raw[0]); \
diff --git a/xen/include/asm-x86/fixmap.h b/xen/include/asm-x86/fixmap.h
index 0db314baeb..20746afd0a 100644
--- a/xen/include/asm-x86/fixmap.h
+++ b/xen/include/asm-x86/fixmap.h
@@ -78,7 +78,7 @@ extern void __set_fixmap(
 
 #define clear_fixmap(idx) __set_fixmap(idx, 0, 0)
 
-#define __fix_to_virt(x) (FIXADDR_TOP - ((x) << PAGE_SHIFT))
+#define __fix_to_virt(x) gcc11_wrap(FIXADDR_TOP - ((x) << PAGE_SHIFT))
 #define __virt_to_fix(x) ((FIXADDR_TOP - ((x)&PAGE_MASK)) >> PAGE_SHIFT)
 
 #define fix_to_virt(x)   ((void *)__fix_to_virt(x))
diff --git a/xen/include/xen/compiler.h b/xen/include/xen/compiler.h
index 17cf00e1ec..696c7eb89e 100644
--- a/xen/include/xen/compiler.h
+++ b/xen/include/xen/compiler.h
@@ -140,6 +140,12 @@
     __asm__ ("" : "=r"(__ptr) : "0"(ptr));      \
     (typeof(ptr)) (__ptr + (off)); })
 
+#if CONFIG_GCC_VERSION >= 110000 /* See gcc bug 100680. */
+# define gcc11_wrap(x) RELOC_HIDE(x, 0)
+#else
+# define gcc11_wrap(x) (x)
+#endif
+
 #ifdef __GCC_ASM_FLAG_OUTPUTS__
 # define ASM_FLAG_OUT(yes, no) yes
 #else
diff --git a/xen/include/xen/pdx.h b/xen/include/xen/pdx.h
index 770fadc06c..9fcfb0ce52 100644
--- a/xen/include/xen/pdx.h
+++ b/xen/include/xen/pdx.h
@@ -19,7 +19,7 @@ extern u64 pdx_region_mask(u64 base, u64 len);
 extern void set_pdx_range(unsigned long smfn, unsigned long emfn);
 
 #define page_to_pdx(pg)  ((pg) - frame_table)
-#define pdx_to_page(pdx) (frame_table + (pdx))
+#define pdx_to_page(pdx) gcc11_wrap(frame_table + (pdx))
 
 bool __mfn_valid(unsigned long mfn);
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu May 27 12:55:05 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 May 2021 12:55:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.133198.248333 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lmFXT-0005A8-7l; Thu, 27 May 2021 12:55:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 133198.248333; Thu, 27 May 2021 12:55:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lmFXT-00059z-4S; Thu, 27 May 2021 12:55:03 +0000
Received: by outflank-mailman (input) for mailman id 133198;
 Thu, 27 May 2021 12:55:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lmFXS-00059Y-Fk
 for xen-changelog@lists.xenproject.org; Thu, 27 May 2021 12:55:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lmFXS-0007te-Ew
 for xen-changelog@lists.xenproject.org; Thu, 27 May 2021 12:55:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lmFXS-0008MA-Cc
 for xen-changelog@lists.xenproject.org; Thu, 27 May 2021 12:55:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=zdyGRdMvDpQ558itIa3SBqQvTUFAyYxAKJeGOiZ1GHI=; b=Hl6+dy8mSqvfZi25hnw07WeYc+
	hzYkFb9cOyH13GCuVYZ9GIwoaT66H+U4rH2WL8ethMIP6NFFkTBm/9EKruoixcKG1MtqtfgTMDCXS
	KmFfi59mGgPj8tdk0CbzT28CjzHzf7BmIOC832C0EHE9CE7Qd+/AYoyENLQWBsoaRdhw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/guest: fix build when HVM and !PV32
Message-Id: <E1lmFXS-0008MA-Cc@xenbits.xenproject.org>
Date: Thu, 27 May 2021 12:55:02 +0000

commit 3673e9ba77bb71a36e9917bf1e487c40dc425c92
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed May 26 09:33:02 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed May 26 09:33:02 2021 +0200

    x86/guest: fix build when HVM and !PV32
    
    The commit referenced below still wasn't careful enough - with COMPAT we
    will have a compat_handle_okay() visible already, which we first need to
    get rid of.
    
    Fixes: bd1e7b47bac0 ("x86/shim: fix build when !PV32")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/pv/shim.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/xen/arch/x86/pv/shim.c b/xen/arch/x86/pv/shim.c
index 8164a0fbde..d9704121a7 100644
--- a/xen/arch/x86/pv/shim.c
+++ b/xen/arch/x86/pv/shim.c
@@ -679,6 +679,7 @@ void pv_shim_inject_evtchn(unsigned int port)
 # include <compat/grant_table.h>
 #else
 # define compat_gnttab_setup_table gnttab_setup_table
+# undef compat_handle_okay
 # define compat_handle_okay guest_handle_okay
 #endif
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu May 27 12:55:13 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 May 2021 12:55:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.133200.248337 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lmFXd-0005Ht-9L; Thu, 27 May 2021 12:55:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 133200.248337; Thu, 27 May 2021 12:55:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lmFXd-0005Hl-5u; Thu, 27 May 2021 12:55:13 +0000
Received: by outflank-mailman (input) for mailman id 133200;
 Thu, 27 May 2021 12:55:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lmFXc-0005HL-Iy
 for xen-changelog@lists.xenproject.org; Thu, 27 May 2021 12:55:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lmFXc-0007tn-IA
 for xen-changelog@lists.xenproject.org; Thu, 27 May 2021 12:55:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lmFXc-0008N8-HA
 for xen-changelog@lists.xenproject.org; Thu, 27 May 2021 12:55:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=PRxGPOdmIdormiGapruTuIurXqNFZuAGNE3BTIUL384=; b=YpiDjrKOP3lTyMYIuuu0JWd/67
	wul6DrnMgwkKepcluLxkuFrjywvkFUzCOa9XQEzioMYhPheHYPCp8Pi3qrpona9b8IJCAXrkA+LbS
	+09qaptz2av+6TzDHKqw8DuYNjI2isTpysPQ3/ncb0E1EpL3OBoJMYMCRgpCwUaHZK4Y=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] firmware/shim: update linkfarm exclusions
Message-Id: <E1lmFXc-0008N8-HA@xenbits.xenproject.org>
Date: Thu, 27 May 2021 12:55:12 +0000

commit 022da003747a7f4336f8c581fdf898a7d5cd47e4
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed May 26 09:34:07 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed May 26 09:34:07 2021 +0200

    firmware/shim: update linkfarm exclusions
    
    Some intermediate files weren't considered at all at the time. Also
    after its introduction, various changes to the build environment have
    rendered the exclusion sets stale. For example, we now have some .*.cmd
    files in the build tree. Combine all respective patterns into a single
    .* one, seeing that we don't have any actual source files matching this
    pattern in the tree. Add other patterns as well as individual files.
    Also introduce LINK_EXCLUDE_PATHS to deal with entire directories full
    of generated headers as well as a few specific files the names of which
    are too generic to list under LINK_EXCLUDES.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 tools/firmware/xen-dir/Makefile | 26 +++++++++++++++++++-------
 1 file changed, 19 insertions(+), 7 deletions(-)

diff --git a/tools/firmware/xen-dir/Makefile b/tools/firmware/xen-dir/Makefile
index 5413f86790..afc651f861 100644
--- a/tools/firmware/xen-dir/Makefile
+++ b/tools/firmware/xen-dir/Makefile
@@ -15,9 +15,19 @@ DEP_DIRS=$(foreach i, $(LINK_DIRS), $(XEN_ROOT)/$(i))
 DEP_FILES=$(foreach i, $(LINK_FILES), $(XEN_ROOT)/$(i))
 
 # Exclude some intermediate files and final build products
-LINK_EXCLUDES := '*.[isoa]' '.*.d' '.*.d2' '.config'
-LINK_EXCLUDES += '*.map' 'xen' 'xen.gz' 'xen.efi' 'xen-syms'
-LINK_EXCLUDES += '.*.tmp'
+LINK_EXCLUDES := '*.[isoa]' '*.bin' '*.chk' '*.lnk' '*.gz' '.*'
+LINK_EXCLUDES += lexer.lex.? parser.tab.? conf
+LINK_EXCLUDES += asm-offsets.h asm-macros.h compile.h '*-autogen.h'
+LINK_EXCLUDES += mkelf32 mkreloc symbols config_data.S xen.lds efi.lds
+LINK_EXCLUDES += '*.map' xen xen.gz xen.efi xen-syms check.efi
+
+# To exclude full subtrees or individual files of not sufficiently specific
+# names, regular expressions are used:
+LINK_EXCLUDE_PATHS := xen/include/compat/.*
+LINK_EXCLUDE_PATHS += xen/include/config/.*
+LINK_EXCLUDE_PATHS += xen/include/generated/.*
+LINK_EXCLUDE_PATHS += xen/arch/x86/boot/reloc[.]S
+LINK_EXCLUDE_PATHS += xen/arch/x86/boot/cmdline[.]S
 
 # This is all a giant mess and doesn't really work.
 #
@@ -32,9 +42,10 @@ LINK_EXCLUDES += '.*.tmp'
 # support easy development of the shim, but has a side effect of clobbering
 # the already-built shim.
 #
-# $(LINK_EXCLUDES) should be set such that a parallel build of shim and xen/
-# doesn't cause a subsequent `make install` to decide to regenerate the
-# linkfarm.  This means that all final build artefacts must be excluded.
+# $(LINK_EXCLUDES) and $(LINK_EXCLUDE_DIRS) should be set such that a parallel
+# build of shim and xen/ doesn't cause a subsequent `make install` to decide to
+# regenerate the linkfarm.  This means that all intermediate and final build
+# artefacts must be excluded.
 linkfarm.stamp: $(DEP_DIRS) $(DEP_FILES) FORCE
 	mkdir -p $(D)
 	rm -f linkfarm.stamp.tmp
@@ -46,7 +57,8 @@ linkfarm.stamp: $(DEP_DIRS) $(DEP_FILES) FORCE
 			sed 's,^$(XEN_ROOT)/$(d)/,,g' | xargs mkdir -p .);) \
 	$(foreach d, $(LINK_DIRS), \
 		(cd $(XEN_ROOT); \
-		 find $(d) ! -type l -type f $(addprefix ! -name ,$(LINK_EXCLUDES))) \
+		 find $(d) ! -type l -type f $(addprefix ! -name ,$(LINK_EXCLUDES)) \
+		 | grep -v $(patsubst %,-e '^%$$',$(LINK_EXCLUDE_PATHS))) \
 		 >> linkfarm.stamp.tmp ; ) \
 	$(foreach f, $(LINK_FILES), \
 		echo $(f) >> linkfarm.stamp.tmp ;)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu May 27 12:55:23 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 May 2021 12:55:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.133203.248340 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lmFXn-0005W6-A9; Thu, 27 May 2021 12:55:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 133203.248340; Thu, 27 May 2021 12:55:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lmFXn-0005W1-7J; Thu, 27 May 2021 12:55:23 +0000
Received: by outflank-mailman (input) for mailman id 133203;
 Thu, 27 May 2021 12:55:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lmFXm-0005Vj-M8
 for xen-changelog@lists.xenproject.org; Thu, 27 May 2021 12:55:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lmFXm-0007u1-LN
 for xen-changelog@lists.xenproject.org; Thu, 27 May 2021 12:55:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lmFXm-0008O2-KP
 for xen-changelog@lists.xenproject.org; Thu, 27 May 2021 12:55:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=CVUWKe8DQlYTuRiN3tLDU5ExO+rwrPguDFm+3Pw/DOg=; b=Wr6fAtCHKrexxjC1z0wv7YnQkx
	i9WTKwlHBc/d0mbkLoLMk1I7zBod5IueYm0OXaqFlVnTXRPhk2Pl2ItoiaxTIbbs3CMcSKDJ+eGLl
	GPhQmqhCjvl0+YodOc/tbTteKDXuD05miAzkxsD63r1EjPkuRwtc+wOZB5yCqAdd5XWo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] firmware/shim: drop XEN_CONFIG_EXPERT uses
Message-Id: <E1lmFXm-0008O2-KP@xenbits.xenproject.org>
Date: Thu, 27 May 2021 12:55:22 +0000

commit 7793d19bac84cb84d919035faa9aa638f0a33370
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed May 26 09:34:37 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed May 26 09:34:37 2021 +0200

    firmware/shim: drop XEN_CONFIG_EXPERT uses
    
    As of commit d155e4aef35c ("xen: Allow EXPERT mode to be selected from
    the menuconfig directly") EXPERT is a regular config option (which the
    shim default config also enables).
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <rogerpau@citrix.com>
---
 tools/firmware/xen-dir/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/firmware/xen-dir/Makefile b/tools/firmware/xen-dir/Makefile
index afc651f861..6f5e208ab4 100644
--- a/tools/firmware/xen-dir/Makefile
+++ b/tools/firmware/xen-dir/Makefile
@@ -74,10 +74,10 @@ $(D): linkfarm.stamp
 	$(MAKE) -C $(D)/xen distclean
 
 $(D)/xen/.config: $(D)
-	$(MAKE) -C $(@D) KBUILD_DEFCONFIG=pvshim_defconfig XEN_CONFIG_EXPERT=y defconfig
+	$(MAKE) -C $(@D) KBUILD_DEFCONFIG=pvshim_defconfig defconfig
 
 xen-shim: $(D)/xen/.config
-	$(MAKE) -C $(<D) build XEN_CONFIG_EXPERT=y
+	$(MAKE) -C $(<D) build
 	ln -sf $(D)/xen/xen $@
 	ln -sf $(D)/xen/xen-syms $@-syms
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu May 27 12:55:34 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 May 2021 12:55:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.133205.248345 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lmFXy-0005dK-CH; Thu, 27 May 2021 12:55:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 133205.248345; Thu, 27 May 2021 12:55:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lmFXy-0005dB-94; Thu, 27 May 2021 12:55:34 +0000
Received: by outflank-mailman (input) for mailman id 133205;
 Thu, 27 May 2021 12:55:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lmFXw-0005ch-PP
 for xen-changelog@lists.xenproject.org; Thu, 27 May 2021 12:55:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lmFXw-0007uB-OZ
 for xen-changelog@lists.xenproject.org; Thu, 27 May 2021 12:55:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lmFXw-0008On-NZ
 for xen-changelog@lists.xenproject.org; Thu, 27 May 2021 12:55:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=GbqIuX2vcD+Pc58qn/dhigdlztqjJqSCLFAWYpiAPO8=; b=V5AEKPUbrqgB0DpUKxaSaXER0M
	BMc05vyQTmJ73SZqJ0Ahu0iLeN2yVrsPv0p3OcNDGsdMTqusAfChROwXgq2G3yMNtLiDy0SZr7UlJ
	IuBIB/AR8Y9jNgYPgUnMVn5sPZqY4yowWfVQjL5uZvI9tO0J5BO/CZL7mc4IngJOQhWw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/char: console: Use const whenever we point to literal strings
Message-Id: <E1lmFXw-0008On-NZ@xenbits.xenproject.org>
Date: Thu, 27 May 2021 12:55:32 +0000

commit b0a5b1735c704ec2055e52587a7c5b94370911c0
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Wed May 26 16:01:32 2021 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Wed May 26 16:01:32 2021 +0100

    xen/char: console: Use const whenever we point to literal strings
    
    Literal strings are not meant to be modified. So we should use const
    char * rather than char * when we want to store a pointer to them.
    
    The array should also not be modified at all and is only used by
    xenlog_update_val(). So take the opportunity to add an extra const and
    move the definition in the function.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
---
 xen/drivers/char/console.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/xen/drivers/char/console.c b/xen/drivers/char/console.c
index 2358375170..7d0a603d03 100644
--- a/xen/drivers/char/console.c
+++ b/xen/drivers/char/console.c
@@ -168,10 +168,11 @@ static int parse_guest_loglvl(const char *s);
 static char xenlog_val[LOGLVL_VAL_SZ];
 static char xenlog_guest_val[LOGLVL_VAL_SZ];
 
-static char *lvl2opt[] = { "none", "error", "warning", "info", "all" };
-
 static void xenlog_update_val(int lower, int upper, char *val)
 {
+    static const char * const lvl2opt[] =
+        { "none", "error", "warning", "info", "all" };
+
     snprintf(val, LOGLVL_VAL_SZ, "%s/%s", lvl2opt[lower], lvl2opt[upper]);
 }
 
@@ -262,7 +263,7 @@ static int parse_guest_loglvl(const char *s)
     return ret;
 }
 
-static char *loglvl_str(int lvl)
+static const char *loglvl_str(int lvl)
 {
     switch ( lvl )
     {
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu May 27 12:55:44 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 May 2021 12:55:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.133207.248349 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lmFY8-0005hd-DQ; Thu, 27 May 2021 12:55:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 133207.248349; Thu, 27 May 2021 12:55:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lmFY8-0005hV-AX; Thu, 27 May 2021 12:55:44 +0000
Received: by outflank-mailman (input) for mailman id 133207;
 Thu, 27 May 2021 12:55:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lmFY6-0005gv-SY
 for xen-changelog@lists.xenproject.org; Thu, 27 May 2021 12:55:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lmFY6-0007uf-Rl
 for xen-changelog@lists.xenproject.org; Thu, 27 May 2021 12:55:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lmFY6-0008PO-Qm
 for xen-changelog@lists.xenproject.org; Thu, 27 May 2021 12:55:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Emc4sT9betWP+kubKJU/eQIR4Yz3CIWBe2OuyfJgaS4=; b=FcmmP3mdWim5YKSTRFH+v9z6lu
	XACPDbuuycljHIWASVAfeJxBzfEMRw5nNWP1OVZIP7HEqb0DWNbsD1qjNhtJsLGmA9X2WWnvic2VN
	pjjKSapCJ+yxzT6fLA+x5NHmz+8seulf5cavczP0aLaTEOBnASbiGJ8Yxvsdo9nD5lg8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/console: Use const whenever we point to literal strings
Message-Id: <E1lmFY6-0008PO-Qm@xenbits.xenproject.org>
Date: Thu, 27 May 2021 12:55:42 +0000

commit 3beb2ee6be1d15f9f3c2bb89160803da21dc7e20
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Wed May 26 16:01:51 2021 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Wed May 26 16:01:51 2021 +0100

    tools/console: Use const whenever we point to literal strings
    
    Literal strings are not meant to be modified. So we should use const
    char * rather than char * when we want to store a pointer to them.
    
    Take the opportunity to remove the cast (char *) in console_init(). It
    is unnecessary and will remove the const.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Acked-by: Wei Liu <wl@xen.org>
    Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
---
 tools/console/client/main.c |  4 ++--
 tools/console/daemon/io.c   | 15 ++++++++-------
 2 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/tools/console/client/main.c b/tools/console/client/main.c
index 088be28dff..80157be421 100644
--- a/tools/console/client/main.c
+++ b/tools/console/client/main.c
@@ -325,7 +325,7 @@ int main(int argc, char **argv)
 {
 	struct termios attr;
 	int domid;
-	char *sopt = "hn:";
+	const char *sopt = "hn:";
 	int ch;
 	unsigned int num = 0;
 	int opt_ind=0;
@@ -345,7 +345,7 @@ int main(int argc, char **argv)
 	char *end;
 	console_type type = CONSOLE_INVAL;
 	bool interactive = 0;
-	char *console_names = "serial, pv, vuart";
+	const char *console_names = "serial, pv, vuart";
 
 	while((ch = getopt_long(argc, argv, sopt, lopt, &opt_ind)) != -1) {
 		switch(ch) {
diff --git a/tools/console/daemon/io.c b/tools/console/daemon/io.c
index 4af27ffc5d..200b575d76 100644
--- a/tools/console/daemon/io.c
+++ b/tools/console/daemon/io.c
@@ -87,14 +87,14 @@ struct buffer {
 };
 
 struct console {
-	char *ttyname;
+	const char *ttyname;
 	int master_fd;
 	int master_pollfd_idx;
 	int slave_fd;
 	int log_fd;
 	struct buffer buffer;
 	char *xspath;
-	char *log_suffix;
+	const char *log_suffix;
 	int ring_ref;
 	xenevtchn_handle *xce_handle;
 	int xce_pollfd_idx;
@@ -109,9 +109,9 @@ struct console {
 };
 
 struct console_type {
-	char *xsname;
-	char *ttyname;
-	char *log_suffix;
+	const char *xsname;
+	const char *ttyname;
+	const char *log_suffix;
 	bool optional;
 	bool use_gnttab;
 };
@@ -813,7 +813,8 @@ static int console_init(struct console *con, struct domain *dom, void **data)
 	int err = -1;
 	struct timespec ts;
 	struct console_type **con_type = (struct console_type **)data;
-	char *xsname, *xspath;
+	const char *xsname;
+	char *xspath;
 
 	if (clock_gettime(CLOCK_MONOTONIC, &ts) < 0) {
 		dolog(LOG_ERR, "Cannot get time of day %s:%s:L%d",
@@ -835,7 +836,7 @@ static int console_init(struct console *con, struct domain *dom, void **data)
 	con->log_suffix = (*con_type)->log_suffix;
 	con->optional = (*con_type)->optional;
 	con->use_gnttab = (*con_type)->use_gnttab;
-	xsname = (char *)(*con_type)->xsname;
+	xsname = (*con_type)->xsname;
 	xspath = xs_get_domain_path(xs, dom->domid);
 	s = realloc(xspath, strlen(xspath) +
 		    strlen(xsname) + 1);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu May 27 12:55:54 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 May 2021 12:55:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.133208.248353 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lmFYI-0005m0-GD; Thu, 27 May 2021 12:55:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 133208.248353; Thu, 27 May 2021 12:55:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lmFYI-0005lt-DJ; Thu, 27 May 2021 12:55:54 +0000
Received: by outflank-mailman (input) for mailman id 133208;
 Thu, 27 May 2021 12:55:53 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lmFYG-0005lT-Vj
 for xen-changelog@lists.xenproject.org; Thu, 27 May 2021 12:55:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lmFYG-0007wR-V0
 for xen-changelog@lists.xenproject.org; Thu, 27 May 2021 12:55:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lmFYG-0008QD-UE
 for xen-changelog@lists.xenproject.org; Thu, 27 May 2021 12:55:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=i2zCUnVuXuWOcBcFOo2Oxtju1DXoDcCfLCuiEmzFG5w=; b=PkAhOFrcjGpmOiLvA/Ex7ZU24a
	lHQU2HwBrQhShedii1PFz/QjUkqFFRecnOAsEZ6vl350h+0TNd0IagNQtL5SNhGpHLFchA+VLflb6
	UrwnJARyxWPwO+bf3bdNz6qtk4Kegb3WS/rzNbjVx8afOyFiYAm0l2MJr5r1+crcoXtI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/xenstored: Remove unused parameter in check_domains()
Message-Id: <E1lmFYG-0008QD-UE@xenbits.xenproject.org>
Date: Thu, 27 May 2021 12:55:52 +0000

commit 7c110dd335a17be52549dc4b9dfbfba8165ade40
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Wed May 26 16:35:53 2021 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Wed May 26 16:35:53 2021 +0100

    tools/xenstored: Remove unused parameter in check_domains()
    
    The parameter of check_domains() is not used within the function. In fact,
    this was a left over of the original implementation as the version merged
    doesn't need to know whether we are restoring.
    
    So remove it.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
---
 tools/xenstore/xenstored_control.c | 2 +-
 tools/xenstore/xenstored_domain.c  | 4 ++--
 tools/xenstore/xenstored_domain.h  | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/xenstore/xenstored_control.c b/tools/xenstore/xenstored_control.c
index 52d4817679..2c63ba7ead 100644
--- a/tools/xenstore/xenstored_control.c
+++ b/tools/xenstore/xenstored_control.c
@@ -589,7 +589,7 @@ void lu_read_state(void)
 	 * have died while we were live-updating. So check all the domains are
 	 * still alive.
 	 */
-	check_domains(true);
+	check_domains();
 }
 
 static const char *lu_activate_binary(const void *ctx)
diff --git a/tools/xenstore/xenstored_domain.c b/tools/xenstore/xenstored_domain.c
index 708bf68af0..322b0dbca4 100644
--- a/tools/xenstore/xenstored_domain.c
+++ b/tools/xenstore/xenstored_domain.c
@@ -227,7 +227,7 @@ static bool get_domain_info(unsigned int domid, xc_dominfo_t *dominfo)
 	       dominfo->domid == domid;
 }
 
-void check_domains(bool restore)
+void check_domains(void)
 {
 	xc_dominfo_t dominfo;
 	struct domain *domain;
@@ -284,7 +284,7 @@ void handle_event(void)
 		barf_perror("Failed to read from event fd");
 
 	if (port == virq_port)
-		check_domains(false);
+		check_domains();
 
 	if (xenevtchn_unmask(xce_handle, port) == -1)
 		barf_perror("Failed to write to event fd");
diff --git a/tools/xenstore/xenstored_domain.h b/tools/xenstore/xenstored_domain.h
index dc97591713..cc5147d7e7 100644
--- a/tools/xenstore/xenstored_domain.h
+++ b/tools/xenstore/xenstored_domain.h
@@ -21,7 +21,7 @@
 
 void handle_event(void);
 
-void check_domains(bool restore);
+void check_domains(void);
 
 /* domid, mfn, eventchn, path */
 int do_introduce(struct connection *conn, struct buffered_data *in);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu May 27 18:44:13 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 May 2021 18:44:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.133645.249022 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lmKzG-0004le-Hm; Thu, 27 May 2021 18:44:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 133645.249022; Thu, 27 May 2021 18:44:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lmKzG-0004lV-EG; Thu, 27 May 2021 18:44:06 +0000
Received: by outflank-mailman (input) for mailman id 133645;
 Thu, 27 May 2021 18:44:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lmKzF-0004kq-J5
 for xen-changelog@lists.xenproject.org; Thu, 27 May 2021 18:44:05 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lmKzF-0006E5-GK
 for xen-changelog@lists.xenproject.org; Thu, 27 May 2021 18:44:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lmKzF-00062b-FJ
 for xen-changelog@lists.xenproject.org; Thu, 27 May 2021 18:44:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=pwMbLOQetabyITshy0vXeMr0T2Fl+HMnS7oJwMaa1bI=; b=SacnKwqxkkaTJO8CmyRHXdtLgz
	+wXw7Gl1Vq1+6qnmRZId1D3ROK7QjPZhOWXIUafw0Apokq8eDF4HbwFjKkMDJJprhRkGAtGxT2e08
	MpCoxBlSknFgDLfvB5ZWhitD2iNMExYASEyCHB+iGoUVHek1bxUsiO+OjO+lr/4mVDLs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/cpuid: Rework HLE and RTM handling
Message-Id: <E1lmKzF-00062b-FJ@xenbits.xenproject.org>
Date: Thu, 27 May 2021 18:44:05 +0000

commit 8fe24090d940d760145ccd5e234290be7418b175
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu May 20 19:48:39 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu May 27 19:34:00 2021 +0100

    x86/cpuid: Rework HLE and RTM handling
    
    The TAA mitigation offered the option to hide the HLE and RTM CPUID bits,
    which has caused some migration compatibility problems.
    
    These two bits are special.  Annotate them with ! to emphasise this point.
    
    Hardware Lock Elision (HLE) may or may not be visible in CPUID, but is
    disabled in microcode on all CPUs, and has been removed from the architecture.
    Do not advertise it to VMs by default.
    
    Restricted Transactional Memory (RTM) may or may not be visible in CPUID, and
    may or may not be configured in force-abort mode.  Have tsx_init() note
    whether RTM has been configured into force-abort mode, so
    guest_common_feature_adjustments() can conditionally hide it from VMs by
    default.
    
    The host policy values for HLE/RTM may or may not be set, depending on any
    previous running kernel's choice of visibility, and Xen's choice.  TSX is
    available on any CPU which enumerates a TSX-hiding mechanism, so instead of
    doing a two-step to clobber any hiding, scan CPUID, then set the visibility,
    just force visibility of the bits in the first place.
    
    With the HLE/RTM bits now unilaterally visible in the host policy,
    xc_cpuid_apply_policy() can construct a more appropriate policy out of thin
    air for pre-4.13 VMs with no CPUID data in their migration stream, and
    specifically one where HLE/RTM doesn't potentially disappear behind the back
    of a running VM.
    
    Fixes: 8c4330818f6 ("x86/spec-ctrl: Mitigate the TSX Asynchronous Abort sidechannel")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 tools/libs/guest/xg_cpuid_x86.c             |  2 ++
 xen/arch/x86/cpuid.c                        | 24 ++++++++++------------
 xen/arch/x86/spec_ctrl.c                    |  3 ---
 xen/arch/x86/tsx.c                          | 31 +++++++++++++++++++++++++++--
 xen/include/asm-x86/processor.h             |  1 +
 xen/include/public/arch-x86/cpufeatureset.h |  4 ++--
 6 files changed, 44 insertions(+), 21 deletions(-)

diff --git a/tools/libs/guest/xg_cpuid_x86.c b/tools/libs/guest/xg_cpuid_x86.c
index 1ebc108213..ec5a47fde4 100644
--- a/tools/libs/guest/xg_cpuid_x86.c
+++ b/tools/libs/guest/xg_cpuid_x86.c
@@ -511,6 +511,8 @@ int xc_cpuid_apply_policy(xc_interface *xch, uint32_t domid, bool restore,
          * so migrated-in VM's don't risk seeing features disappearing.
          */
         p->basic.rdrand = test_bit(X86_FEATURE_RDRAND, host_featureset);
+        p->feat.hle = test_bit(X86_FEATURE_HLE, host_featureset);
+        p->feat.rtm = test_bit(X86_FEATURE_RTM, host_featureset);
 
         if ( di.hvm )
         {
diff --git a/xen/arch/x86/cpuid.c b/xen/arch/x86/cpuid.c
index 752bf244ea..55a7b16342 100644
--- a/xen/arch/x86/cpuid.c
+++ b/xen/arch/x86/cpuid.c
@@ -375,6 +375,16 @@ static void __init guest_common_default_feature_adjustments(uint32_t *fs)
          boot_cpu_data.x86 == 6 && boot_cpu_data.x86_model == 0x3a &&
          cpu_has_rdrand && !is_forced_cpu_cap(X86_FEATURE_RDRAND) )
         __clear_bit(X86_FEATURE_RDRAND, fs);
+
+    /*
+     * On certain hardware, speculative or errata workarounds can result in
+     * TSX being placed in "force-abort" mode, where it doesn't actually
+     * function as expected, but is technically compatible with the ISA.
+     *
+     * Do not advertise RTM to guests by default if it won't actually work.
+     */
+    if ( rtm_disabled )
+        __clear_bit(X86_FEATURE_RTM, fs);
 }
 
 static void __init guest_common_feature_adjustments(uint32_t *fs)
@@ -652,20 +662,6 @@ void recalculate_cpuid_policy(struct domain *d)
             __clear_bit(X86_FEATURE_SYSCALL, max_fs);
     }
 
-    /*
-     * On hardware with MSR_TSX_CTRL, the admin may have elected to disable
-     * TSX and hide the feature bits.  Migrating-in VMs may have been booted
-     * pre-mitigation when the TSX features were visbile.
-     *
-     * This situation is compatible (albeit with a perf hit to any TSX code in
-     * the guest), so allow the feature bits to remain set.
-     */
-    if ( cpu_has_tsx_ctrl )
-    {
-        __set_bit(X86_FEATURE_HLE, max_fs);
-        __set_bit(X86_FEATURE_RTM, max_fs);
-    }
-
     /* Clamp the toolstacks choices to reality. */
     for ( i = 0; i < ARRAY_SIZE(fs); i++ )
         fs[i] &= max_fs[i];
diff --git a/xen/arch/x86/spec_ctrl.c b/xen/arch/x86/spec_ctrl.c
index cd05f42394..f2782b2d55 100644
--- a/xen/arch/x86/spec_ctrl.c
+++ b/xen/arch/x86/spec_ctrl.c
@@ -1158,9 +1158,6 @@ void __init init_speculation_mitigations(void)
          ((hw_smt_enabled && opt_smt) ||
           !boot_cpu_has(X86_FEATURE_SC_VERW_IDLE)) )
     {
-        setup_clear_cpu_cap(X86_FEATURE_HLE);
-        setup_clear_cpu_cap(X86_FEATURE_RTM);
-
         opt_tsx = 0;
         tsx_init();
     }
diff --git a/xen/arch/x86/tsx.c b/xen/arch/x86/tsx.c
index 39e483640a..e09e819dce 100644
--- a/xen/arch/x86/tsx.c
+++ b/xen/arch/x86/tsx.c
@@ -15,6 +15,7 @@
  */
 int8_t __read_mostly opt_tsx = -1;
 int8_t __read_mostly cpu_has_tsx_ctrl = -1;
+bool __read_mostly rtm_disabled;
 
 static int __init parse_tsx(const char *s)
 {
@@ -45,6 +46,30 @@ void tsx_init(void)
             rdmsrl(MSR_ARCH_CAPABILITIES, caps);
 
         cpu_has_tsx_ctrl = !!(caps & ARCH_CAPS_TSX_CTRL);
+
+        /*
+         * The TSX features (HLE/RTM) are handled specially.  They both
+         * enumerate features but, on certain parts, have mechanisms to be
+         * hidden without disrupting running software.
+         *
+         * At the moment, we're running in an unknown context (WRT hiding -
+         * particularly if another fully fledged kernel ran before us) and
+         * depending on user settings, may elect to continue hiding them from
+         * native CPUID instructions.
+         *
+         * Xen doesn't use TSX itself, but use cpu_has_{hle,rtm} for various
+         * system reasons, mostly errata detection, so the meaning is more
+         * useful as "TSX infrastructure available", as opposed to "features
+         * advertised and working".
+         *
+         * Force the features to be visible in Xen's view if we see any of the
+         * infrastructure capable of hiding them.
+         */
+        if ( cpu_has_tsx_ctrl )
+        {
+            setup_force_cpu_cap(X86_FEATURE_HLE);
+            setup_force_cpu_cap(X86_FEATURE_RTM);
+        }
     }
 
     if ( cpu_has_tsx_ctrl )
@@ -53,9 +78,11 @@ void tsx_init(void)
 
         rdmsrl(MSR_TSX_CTRL, val);
 
+        /* Check bottom bit only.  Higher bits are various sentinels. */
+        rtm_disabled = !(opt_tsx & 1);
+
         val &= ~(TSX_CTRL_RTM_DISABLE | TSX_CTRL_CPUID_CLEAR);
-        /* Check bottom bit only.  Higher bits are various sentinals. */
-        if ( !(opt_tsx & 1) )
+        if ( rtm_disabled )
             val |= TSX_CTRL_RTM_DISABLE | TSX_CTRL_CPUID_CLEAR;
 
         wrmsrl(MSR_TSX_CTRL, val);
diff --git a/xen/include/asm-x86/processor.h b/xen/include/asm-x86/processor.h
index 83143d4df8..bc4dc69253 100644
--- a/xen/include/asm-x86/processor.h
+++ b/xen/include/asm-x86/processor.h
@@ -627,6 +627,7 @@ static inline uint8_t get_cpu_family(uint32_t raw, uint8_t *model,
 }
 
 extern int8_t opt_tsx, cpu_has_tsx_ctrl;
+extern bool rtm_disabled;
 void tsx_init(void);
 
 enum ap_boot_method {
diff --git a/xen/include/public/arch-x86/cpufeatureset.h b/xen/include/public/arch-x86/cpufeatureset.h
index c42f56bdd4..b65af42436 100644
--- a/xen/include/public/arch-x86/cpufeatureset.h
+++ b/xen/include/public/arch-x86/cpufeatureset.h
@@ -197,14 +197,14 @@ XEN_CPUFEATURE(FSGSBASE,      5*32+ 0) /*A  {RD,WR}{FS,GS}BASE instructions */
 XEN_CPUFEATURE(TSC_ADJUST,    5*32+ 1) /*S  TSC_ADJUST MSR available */
 XEN_CPUFEATURE(SGX,           5*32+ 2) /*   Software Guard extensions */
 XEN_CPUFEATURE(BMI1,          5*32+ 3) /*A  1st bit manipulation extensions */
-XEN_CPUFEATURE(HLE,           5*32+ 4) /*A  Hardware Lock Elision */
+XEN_CPUFEATURE(HLE,           5*32+ 4) /*!a Hardware Lock Elision */
 XEN_CPUFEATURE(AVX2,          5*32+ 5) /*A  AVX2 instructions */
 XEN_CPUFEATURE(FDP_EXCP_ONLY, 5*32+ 6) /*!  x87 FDP only updated on exception. */
 XEN_CPUFEATURE(SMEP,          5*32+ 7) /*S  Supervisor Mode Execution Protection */
 XEN_CPUFEATURE(BMI2,          5*32+ 8) /*A  2nd bit manipulation extensions */
 XEN_CPUFEATURE(ERMS,          5*32+ 9) /*A  Enhanced REP MOVSB/STOSB */
 XEN_CPUFEATURE(INVPCID,       5*32+10) /*H  Invalidate Process Context ID */
-XEN_CPUFEATURE(RTM,           5*32+11) /*A  Restricted Transactional Memory */
+XEN_CPUFEATURE(RTM,           5*32+11) /*!A Restricted Transactional Memory */
 XEN_CPUFEATURE(PQM,           5*32+12) /*   Platform QoS Monitoring */
 XEN_CPUFEATURE(NO_FPU_SEL,    5*32+13) /*!  FPU CS/DS stored as zero */
 XEN_CPUFEATURE(MPX,           5*32+14) /*s  Memory Protection Extensions */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu May 27 18:44:16 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 May 2021 18:44:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.133646.249025 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lmKzQ-0004ne-Ik; Thu, 27 May 2021 18:44:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 133646.249025; Thu, 27 May 2021 18:44:16 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lmKzQ-0004nW-Fv; Thu, 27 May 2021 18:44:16 +0000
Received: by outflank-mailman (input) for mailman id 133646;
 Thu, 27 May 2021 18:44:15 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lmKzP-0004nO-Kt
 for xen-changelog@lists.xenproject.org; Thu, 27 May 2021 18:44:15 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lmKzP-0006E9-Jy
 for xen-changelog@lists.xenproject.org; Thu, 27 May 2021 18:44:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lmKzP-00063S-Iv
 for xen-changelog@lists.xenproject.org; Thu, 27 May 2021 18:44:15 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=tze8HrlMnPSJKiwEiBEwokeTDcxzLz9cUHh+GH3w/f4=; b=t5f47b8wWUWFWmnFtQ78PtsyST
	pwUMJn0vsx80t/gkzLUaCvmOp1i//zInBWCaPhUTmFupazP9CZdhbBEENq2mXCQiU8GlB66brm3io
	C9UPLd0CfH0tgubXi3MfuUlMKE/Z2btlUnzNtpqE+8kWy38SJhn2USykt+BzRtQKMjxQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/tsx: Minor cleanup and improvements
Message-Id: <E1lmKzP-00063S-Iv@xenbits.xenproject.org>
Date: Thu, 27 May 2021 18:44:15 +0000

commit 3670abcaf0324f2aedba0c4dc7939072b27efa1d
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue May 18 14:53:56 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu May 27 19:34:00 2021 +0100

    x86/tsx: Minor cleanup and improvements
    
     * Introduce cpu_has_arch_caps and replace boot_cpu_has(X86_FEATURE_ARCH_CAPS)
     * Read CPUID data into the appropriate boot_cpu_data.x86_capability[]
       element, as subsequent changes are going to need more cpu_has_* logic.
     * Use the hi/lo MSR helpers, which substantially improves code generation.
    
    No practical change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/cpuid.c             |  2 +-
 xen/arch/x86/hvm/vmx/vmx.c       |  2 +-
 xen/arch/x86/msr.c               |  2 +-
 xen/arch/x86/spec_ctrl.c         |  2 +-
 xen/arch/x86/tsx.c               | 21 ++++++++++++---------
 xen/include/asm-x86/cpufeature.h |  1 +
 6 files changed, 17 insertions(+), 13 deletions(-)

diff --git a/xen/arch/x86/cpuid.c b/xen/arch/x86/cpuid.c
index 55a7b16342..f3c8950aa3 100644
--- a/xen/arch/x86/cpuid.c
+++ b/xen/arch/x86/cpuid.c
@@ -747,7 +747,7 @@ int init_domain_cpuid_policy(struct domain *d)
      * so dom0 can turn off workarounds as appropriate.  Temporary, until the
      * domain policy logic gains a better understanding of MSRs.
      */
-    if ( is_hardware_domain(d) && boot_cpu_has(X86_FEATURE_ARCH_CAPS) )
+    if ( is_hardware_domain(d) && cpu_has_arch_caps )
         p->feat.arch_caps = true;
 
     d->arch.cpuid = p;
diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index 1450fd1991..7e3e67fdc3 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -2566,7 +2566,7 @@ static bool __init has_if_pschange_mc(void)
     if ( cpu_has_hypervisor )
         return false;
 
-    if ( boot_cpu_has(X86_FEATURE_ARCH_CAPS) )
+    if ( cpu_has_arch_caps )
         rdmsrl(MSR_ARCH_CAPABILITIES, caps);
 
     if ( caps & ARCH_CAPS_IF_PSCHANGE_MC_NO )
diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
index c3a988bd11..374f92b2c5 100644
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -136,7 +136,7 @@ int init_domain_msr_policy(struct domain *d)
      * so dom0 can turn off workarounds as appropriate.  Temporary, until the
      * domain policy logic gains a better understanding of MSRs.
      */
-    if ( is_hardware_domain(d) && boot_cpu_has(X86_FEATURE_ARCH_CAPS) )
+    if ( is_hardware_domain(d) && cpu_has_arch_caps )
     {
         uint64_t val;
 
diff --git a/xen/arch/x86/spec_ctrl.c b/xen/arch/x86/spec_ctrl.c
index f2782b2d55..739b7913ff 100644
--- a/xen/arch/x86/spec_ctrl.c
+++ b/xen/arch/x86/spec_ctrl.c
@@ -885,7 +885,7 @@ void __init init_speculation_mitigations(void)
     bool cpu_has_bug_taa;
     uint64_t caps = 0;
 
-    if ( boot_cpu_has(X86_FEATURE_ARCH_CAPS) )
+    if ( cpu_has_arch_caps )
         rdmsrl(MSR_ARCH_CAPABILITIES, caps);
 
     hw_smt_enabled = check_smt_enabled();
diff --git a/xen/arch/x86/tsx.c b/xen/arch/x86/tsx.c
index e09e819dce..98ecb71a4a 100644
--- a/xen/arch/x86/tsx.c
+++ b/xen/arch/x86/tsx.c
@@ -34,15 +34,18 @@ void tsx_init(void)
 {
     /*
      * This function is first called between microcode being loaded, and CPUID
-     * being scanned generally.  Calculate from raw data whether MSR_TSX_CTRL
-     * is available.
+     * being scanned generally.  Read into boot_cpu_data.x86_capability[] for
+     * the cpu_has_* bits we care about using here.
      */
     if ( unlikely(cpu_has_tsx_ctrl < 0) )
     {
         uint64_t caps = 0;
 
-        if ( boot_cpu_data.cpuid_level >= 7 &&
-             (cpuid_count_edx(7, 0) & cpufeat_mask(X86_FEATURE_ARCH_CAPS)) )
+        if ( boot_cpu_data.cpuid_level >= 7 )
+            boot_cpu_data.x86_capability[cpufeat_word(X86_FEATURE_ARCH_CAPS)]
+                = cpuid_count_edx(7, 0);
+
+        if ( cpu_has_arch_caps )
             rdmsrl(MSR_ARCH_CAPABILITIES, caps);
 
         cpu_has_tsx_ctrl = !!(caps & ARCH_CAPS_TSX_CTRL);
@@ -74,18 +77,18 @@ void tsx_init(void)
 
     if ( cpu_has_tsx_ctrl )
     {
-        uint64_t val;
+        uint32_t hi, lo;
 
-        rdmsrl(MSR_TSX_CTRL, val);
+        rdmsr(MSR_TSX_CTRL, lo, hi);
 
         /* Check bottom bit only.  Higher bits are various sentinels. */
         rtm_disabled = !(opt_tsx & 1);
 
-        val &= ~(TSX_CTRL_RTM_DISABLE | TSX_CTRL_CPUID_CLEAR);
+        lo &= ~(TSX_CTRL_RTM_DISABLE | TSX_CTRL_CPUID_CLEAR);
         if ( rtm_disabled )
-            val |= TSX_CTRL_RTM_DISABLE | TSX_CTRL_CPUID_CLEAR;
+            lo |= TSX_CTRL_RTM_DISABLE | TSX_CTRL_CPUID_CLEAR;
 
-        wrmsrl(MSR_TSX_CTRL, val);
+        wrmsr(MSR_TSX_CTRL, lo, hi);
     }
     else if ( opt_tsx >= 0 )
         printk_once(XENLOG_WARNING
diff --git a/xen/include/asm-x86/cpufeature.h b/xen/include/asm-x86/cpufeature.h
index 33b2257888..9f5ae3aa0d 100644
--- a/xen/include/asm-x86/cpufeature.h
+++ b/xen/include/asm-x86/cpufeature.h
@@ -133,6 +133,7 @@
 #define cpu_has_avx512_vp2intersect boot_cpu_has(X86_FEATURE_AVX512_VP2INTERSECT)
 #define cpu_has_tsx_force_abort boot_cpu_has(X86_FEATURE_TSX_FORCE_ABORT)
 #define cpu_has_serialize       boot_cpu_has(X86_FEATURE_SERIALIZE)
+#define cpu_has_arch_caps       boot_cpu_has(X86_FEATURE_ARCH_CAPS)
 
 /* CPUID level 0x00000007:1.eax */
 #define cpu_has_avx_vnni        boot_cpu_has(X86_FEATURE_AVX_VNNI)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu May 27 18:44:26 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 May 2021 18:44:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.133647.249030 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lmKza-0004qe-Kk; Thu, 27 May 2021 18:44:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 133647.249030; Thu, 27 May 2021 18:44:26 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lmKza-0004qW-Hq; Thu, 27 May 2021 18:44:26 +0000
Received: by outflank-mailman (input) for mailman id 133647;
 Thu, 27 May 2021 18:44:25 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lmKzZ-0004qO-Q5
 for xen-changelog@lists.xenproject.org; Thu, 27 May 2021 18:44:25 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lmKzZ-0006ER-PG
 for xen-changelog@lists.xenproject.org; Thu, 27 May 2021 18:44:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lmKzZ-00064h-Nh
 for xen-changelog@lists.xenproject.org; Thu, 27 May 2021 18:44:25 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=AsxaFaFXSmIWS6asxw0TfGxrl5e3jflqJxVe4hnpmQo=; b=lOBL2C4AUu2qQR3VFWYmFnw46R
	FimPrYI3f89Dk+pYF9YyiW5a6xcG2UYRCUYJlPMrwTbKrvpYCXgiwn3eWCybFui3IqScPoleVgb41
	kKmU6GF9MmdJTs5z1niqJhn1ZaOfSf2UiD7/qfUz3XptHomGIq9obmR1P4WO7HqQdBNU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/tsx: Deprecate vpmu=rtm-abort and use tsx=<bool> instead
Message-Id: <E1lmKzZ-00064h-Nh@xenbits.xenproject.org>
Date: Thu, 27 May 2021 18:44:25 +0000

commit 9fdcf851689cb2a9501d3947cb5d767d9c7797e8
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu May 20 19:16:11 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu May 27 19:34:00 2021 +0100

    x86/tsx: Deprecate vpmu=rtm-abort and use tsx=<bool> instead
    
    This reuses the rtm_disable infrastructure, so CPUID derivation works properly
    when TSX is disabled in favour of working PCR3.
    
    vpmu= is not a supported feature, and having this functionality under tsx=
    centralises all TSX handling.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 docs/misc/xen-command-line.pandoc | 40 +++++++++++++++---------------
 xen/arch/x86/cpu/intel.c          |  3 ---
 xen/arch/x86/cpu/vpmu.c           |  4 +--
 xen/arch/x86/tsx.c                | 51 +++++++++++++++++++++++++++++++++++++--
 xen/include/asm-x86/vpmu.h        |  1 -
 5 files changed, 70 insertions(+), 29 deletions(-)

diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc
index c32a397a12..1fae872626 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -2296,14 +2296,21 @@ pages) must also be specified via the tbuf_size parameter.
 
 Controls for the use of Transactional Synchronization eXtensions.
 
-On Intel parts released in Q3 2019 (with updated microcode), and future parts,
-a control has been introduced which allows TSX to be turned off.
+Several microcode updates are relevant:
 
-On systems with the ability to turn TSX off, this boolean offers system wide
-control of whether TSX is enabled or disabled.
+ * March 2019, fixing the TSX memory ordering errata on all TSX-enabled CPUs
+   to date.  Introduced MSR_TSX_FORCE_ABORT on SKL/SKX/KBL/WHL/CFL parts.  The
+   errata workaround uses Performance Counter 3, so the user can select
+   between working TSX and working perfcounters.
+
+ * November 2019, fixing the TSX Async Abort speculative vulnerability.
+   Introduced MSR_TSX_CTRL on all TSX-enabled MDS_NO parts to date,
+   CLX/WHL-R/CFL-R, with the controls becoming architectural moving forward
+   and formally retiring HLE from the architecture.  The user can disable TSX
+   to mitigate TAA, and elect to hide the HLE/RTM CPUID bits.
 
-On parts vulnerable to CVE-2019-11135 / TSX Asynchronous Abort, the following
-logic applies:
+On systems with the ability to configure TSX, this boolean offers system wide
+control of whether TSX is enabled or disabled.
 
  * An explicit `tsx=` choice is honoured, even if it is `true` and would
    result in a vulnerable system.
@@ -2311,10 +2318,14 @@ logic applies:
  * When no explicit `tsx=` choice is given, parts vulnerable to TAA will be
    mitigated by disabling TSX, as this is the lowest overhead option.
 
- * If the use of TSX is important, the more expensive TAA mitigations can be
+   If the use of TSX is important, the more expensive TAA mitigations can be
    opted in to with `smt=0 spec-ctrl=md-clear`, at which point TSX will remain
    active by default.
 
+ * When no explicit `tsx=` option is given, parts susceptible to the memory
+   ordering errata default to `true` to enable working TSX.  Alternatively,
+   selecting `tsx=0` will disable TSX and restore PCR3 to a working state.
+
 ### ucode
 > `= List of [ <integer> | scan=<bool>, nmi=<bool>, allow-same=<bool> ]`
 
@@ -2456,20 +2467,7 @@ provide access to a wealth of low level processor information.
 
 *   The `arch` option allows access to the pre-defined architectural events.
 
-*   The `rtm-abort` boolean controls a trade-off between working Restricted
-    Transactional Memory, and working performance counters.
-
-    All processors released to date (Q1 2019) supporting Transactional Memory
-    Extensions suffer an erratum which has been addressed in microcode.
-
-    Processors based on the Skylake microarchitecture with up-to-date
-    microcode internally use performance counter 3 to work around the erratum.
-    A consequence is that the counter gets reprogrammed whenever an `XBEGIN`
-    instruction is executed.
-
-    An alternative mode exists where PCR3 behaves as before, at the cost of
-    `XBEGIN` unconditionally aborting.  Enabling `rtm-abort` mode will
-    activate this alternative mode.
+*   The `rtm-abort` boolean has been superseded.  Use `tsx=0` instead.
 
 *Warning:*
 As the virtualisation is not 100% safe, don't use the vpmu flag on
diff --git a/xen/arch/x86/cpu/intel.c b/xen/arch/x86/cpu/intel.c
index 37439071d9..abf8e206d7 100644
--- a/xen/arch/x86/cpu/intel.c
+++ b/xen/arch/x86/cpu/intel.c
@@ -356,9 +356,6 @@ static void Intel_errata_workarounds(struct cpuinfo_x86 *c)
 	    (c->x86_model == 29 || c->x86_model == 46 || c->x86_model == 47))
 		__set_bit(X86_FEATURE_CLFLUSH_MONITOR, c->x86_capability);
 
-	if (cpu_has_tsx_force_abort && opt_rtm_abort)
-		wrmsrl(MSR_TSX_FORCE_ABORT, TSX_FORCE_ABORT_RTM);
-
 	probe_c3_errata(c);
 }
 
diff --git a/xen/arch/x86/cpu/vpmu.c b/xen/arch/x86/cpu/vpmu.c
index d8659c63f8..16e91a3694 100644
--- a/xen/arch/x86/cpu/vpmu.c
+++ b/xen/arch/x86/cpu/vpmu.c
@@ -49,7 +49,6 @@ CHECK_pmu_params;
 static unsigned int __read_mostly opt_vpmu_enabled;
 unsigned int __read_mostly vpmu_mode = XENPMU_MODE_OFF;
 unsigned int __read_mostly vpmu_features = 0;
-bool __read_mostly opt_rtm_abort;
 
 static DEFINE_SPINLOCK(vpmu_lock);
 static unsigned vpmu_count;
@@ -79,7 +78,8 @@ static int __init parse_vpmu_params(const char *s)
         else if ( !cmdline_strcmp(s, "arch") )
             vpmu_features |= XENPMU_FEATURE_ARCH_ONLY;
         else if ( (val = parse_boolean("rtm-abort", s, ss)) >= 0 )
-            opt_rtm_abort = val;
+            printk(XENLOG_WARNING
+                   "'rtm-abort=<bool>' superseded.  Use 'tsx=<bool>' instead\n");
         else
             rc = -EINVAL;
 
diff --git a/xen/arch/x86/tsx.c b/xen/arch/x86/tsx.c
index 98ecb71a4a..338191df7f 100644
--- a/xen/arch/x86/tsx.c
+++ b/xen/arch/x86/tsx.c
@@ -6,7 +6,9 @@
  * Valid values:
  *   1 => Explicit tsx=1
  *   0 => Explicit tsx=0
- *  -1 => Default, implicit tsx=1, may change to 0 to mitigate TAA
+ *  -1 => Default, altered to 0/1 (if unspecified) by:
+ *                 - TAA heuristics/settings for speculative safety
+ *                 - "TSX vs PCR3" select for TSX memory ordering safety
  *  -3 => Implicit tsx=1 (feed-through from spec-ctrl=0)
  *
  * This is arranged such that the bottom bit encodes whether TSX is actually
@@ -50,6 +52,26 @@ void tsx_init(void)
 
         cpu_has_tsx_ctrl = !!(caps & ARCH_CAPS_TSX_CTRL);
 
+        if ( cpu_has_tsx_force_abort )
+        {
+            /*
+             * On an early TSX-enable Skylake part subject to the memory
+             * ordering erratum, with at least the March 2019 microcode.
+             */
+
+            /*
+             * If no explicit tsx= option is provided, pick a default.
+             *
+             * This deliberately overrides the implicit opt_tsx=-3 from
+             * `spec-ctrl=0` because:
+             * - parse_spec_ctrl() ran before any CPU details where know.
+             * - We now know we're running on a CPU not affected by TAA (as
+             *   TSX_FORCE_ABORT is enumerated).
+             */
+            if ( opt_tsx < 0 )
+                opt_tsx = 1;
+        }
+
         /*
          * The TSX features (HLE/RTM) are handled specially.  They both
          * enumerate features but, on certain parts, have mechanisms to be
@@ -75,6 +97,12 @@ void tsx_init(void)
         }
     }
 
+    /*
+     * Note: MSR_TSX_CTRL is enumerated on TSX-enabled MDS_NO and later parts.
+     * MSR_TSX_FORCE_ABORT is enumerated on TSX-enabled pre-MDS_NO Skylake
+     * parts only.  The two features are on a disjoint set of CPUs, and not
+     * offered to guests by hypervisors.
+     */
     if ( cpu_has_tsx_ctrl )
     {
         uint32_t hi, lo;
@@ -90,9 +118,28 @@ void tsx_init(void)
 
         wrmsr(MSR_TSX_CTRL, lo, hi);
     }
+    else if ( cpu_has_tsx_force_abort )
+    {
+        /*
+         * On an early TSX-enable Skylake part subject to the memory ordering
+         * erratum, with at least the March 2019 microcode.
+         */
+        uint32_t hi, lo;
+
+        rdmsr(MSR_TSX_FORCE_ABORT, lo, hi);
+
+        /* Check bottom bit only.  Higher bits are various sentinels. */
+        rtm_disabled = !(opt_tsx & 1);
+
+        lo &= ~TSX_FORCE_ABORT_RTM;
+        if ( rtm_disabled )
+            lo |= TSX_FORCE_ABORT_RTM;
+
+        wrmsr(MSR_TSX_FORCE_ABORT, lo, hi);
+    }
     else if ( opt_tsx >= 0 )
         printk_once(XENLOG_WARNING
-                    "MSR_TSX_CTRL not available - Ignoring tsx= setting\n");
+                    "TSX controls not available - Ignoring tsx= setting\n");
 }
 
 /*
diff --git a/xen/include/asm-x86/vpmu.h b/xen/include/asm-x86/vpmu.h
index 55f85ba00f..4b0a6ba3da 100644
--- a/xen/include/asm-x86/vpmu.h
+++ b/xen/include/asm-x86/vpmu.h
@@ -126,7 +126,6 @@ static inline int vpmu_do_rdmsr(unsigned int msr, uint64_t *msr_content)
 
 extern unsigned int vpmu_mode;
 extern unsigned int vpmu_features;
-extern bool opt_rtm_abort;
 
 /* Context switch */
 static inline void vpmu_switch_from(struct vcpu *prev)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri May 28 07:22:11 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 28 May 2021 07:22:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.133818.249278 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lmWon-00062m-75; Fri, 28 May 2021 07:22:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 133818.249278; Fri, 28 May 2021 07:22:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lmWon-00062d-3u; Fri, 28 May 2021 07:22:05 +0000
Received: by outflank-mailman (input) for mailman id 133818;
 Fri, 28 May 2021 07:22:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lmWom-00062L-MB
 for xen-changelog@lists.xenproject.org; Fri, 28 May 2021 07:22:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lmWom-0000TF-J8
 for xen-changelog@lists.xenproject.org; Fri, 28 May 2021 07:22:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lmWom-0005s3-I6
 for xen-changelog@lists.xenproject.org; Fri, 28 May 2021 07:22:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=8RbtQg0ry5Qz8mjNltAG1KIdscRsdy+Bg/EVXLmqARE=; b=iWH+oOdFg8K1h0ZgzMAXhrg8N7
	gB/aiwZX5vN20ve1rjBHfHOe31mfwBtGftkvVfWmyqJYmrwDsBgIFFIA3x6a+V9pKZVC5ce0nTN9o
	sGnguEick9yNaUtN9/mEAnqoNVypyiEt3gDrWJ4AQswtmj1chZ+TsRoElbJF3aEogN4w=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86: fix build race when generating temporary object files (take 2)
Message-Id: <E1lmWom-0005s3-I6@xenbits.xenproject.org>
Date: Fri, 28 May 2021 07:22:04 +0000

commit 8c90dbb99907f3b471d558775777a84daec7c3f6
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri May 28 09:12:24 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri May 28 09:12:24 2021 +0200

    x86: fix build race when generating temporary object files (take 2)
    
    The original commit wasn't quite sufficient: Emptying DEPS is helpful
    only when nothing will get added to it subsequently. xen/Rules.mk will,
    after including the local Makefile, amend DEPS by dependencies for
    objects living in sub-directories though. For the purpose of suppressing
    dependencies of the makefiles on the .*.d2 files (and thus to avoid
    their re-generation) it is, however, not necessary at all to play with
    DEPS. Instead we can override DEPS_INCLUDE (which generally is a late-
    expansion variable).
    
    Fixes: 761bb575ce97 ("x86: fix build race when generating temporary object files")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile
index 1f5887afc4..2ec883456e 100644
--- a/xen/arch/x86/Makefile
+++ b/xen/arch/x86/Makefile
@@ -313,5 +313,5 @@ clean::
 # Suppress loading of DEPS files for internal, temporary target files.  This
 # then also suppresses re-generation of the respective .*.d2 files.
 ifeq ($(filter-out .xen%.o,$(notdir $(MAKECMDGOALS))),)
-DEPS:=
+DEPS_INCLUDE:=
 endif
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri May 28 07:22:16 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 28 May 2021 07:22:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.133820.249282 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lmWoy-0006Cv-8u; Fri, 28 May 2021 07:22:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 133820.249282; Fri, 28 May 2021 07:22:16 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lmWoy-0006Cn-5K; Fri, 28 May 2021 07:22:16 +0000
Received: by outflank-mailman (input) for mailman id 133820;
 Fri, 28 May 2021 07:22:14 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lmWow-0006BE-Nj
 for xen-changelog@lists.xenproject.org; Fri, 28 May 2021 07:22:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lmWow-0000TL-Mw
 for xen-changelog@lists.xenproject.org; Fri, 28 May 2021 07:22:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lmWow-0005se-Lo
 for xen-changelog@lists.xenproject.org; Fri, 28 May 2021 07:22:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=tbT9mvZzFdHllk4Wezp31bgAEDyLMS5l2cRSCL2QdHM=; b=P6IbOtPgTStIeERkgbblaW33VC
	h3vEiAGufF5GF7/ZRsBTJMrXmrdi6kmXv2zWUirCUv9UKdyRFcxuWMDYZOO8Kyw8JpntzqwCau58k
	e3fGE0cXPVkYVcO73Kec1TY2n+N2/9zZwOfc/bn4iz4WMQne+V/0ZnX12dkPwqSac5Fg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] libelf: don't attempt to parse __xen_guest for PVH
Message-Id: <E1lmWow-0005se-Lo@xenbits.xenproject.org>
Date: Fri, 28 May 2021 07:22:14 +0000

commit dec25a2cd1c8089a39900ed978c8e7ab62d2a4d4
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Fri May 28 09:13:32 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri May 28 09:13:32 2021 +0200

    libelf: don't attempt to parse __xen_guest for PVH
    
    The legacy __xen_guest section doesn't support the PHYS32_ENTRY
    elfnote, so it's pointless to attempt to parse the elfnotes from that
    section when called from an hvm container.
    
    Pass an hvm boolean parameter to the elf note parsing routine, so that
    the respective parsing can be suppressed in case libelf is dealing with
    an hvm container.
    
    Suggested-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 tools/fuzz/libelf/libelf-fuzzer.c   | 3 ++-
 tools/libs/guest/xg_dom_elfloader.c | 6 ++++--
 tools/libs/guest/xg_dom_hvmloader.c | 2 +-
 xen/arch/x86/hvm/dom0_build.c       | 2 +-
 xen/arch/x86/pv/dom0_build.c        | 2 +-
 xen/common/libelf/libelf-dominfo.c  | 8 +++-----
 xen/include/xen/libelf.h            | 2 +-
 7 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/tools/fuzz/libelf/libelf-fuzzer.c b/tools/fuzz/libelf/libelf-fuzzer.c
index 1ba8571711..84fb84720f 100644
--- a/tools/fuzz/libelf/libelf-fuzzer.c
+++ b/tools/fuzz/libelf/libelf-fuzzer.c
@@ -17,7 +17,8 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
         return -1;
 
     elf_parse_binary(elf);
-    elf_xen_parse(elf, &parms);
+    elf_xen_parse(elf, &parms, false);
+    elf_xen_parse(elf, &parms, true);
 
     return 0;
 }
diff --git a/tools/libs/guest/xg_dom_elfloader.c b/tools/libs/guest/xg_dom_elfloader.c
index 0d6247db5d..f17930d98b 100644
--- a/tools/libs/guest/xg_dom_elfloader.c
+++ b/tools/libs/guest/xg_dom_elfloader.c
@@ -135,7 +135,8 @@ static elf_negerrnoval xc_dom_probe_elf_kernel(struct xc_dom_image *dom)
      * or else we might be trying to load a plain ELF.
      */
     elf_parse_binary(&elf);
-    rc = elf_xen_parse(&elf, dom->parms);
+    rc = elf_xen_parse(&elf, dom->parms,
+                       dom->container_type == XC_DOM_HVM_CONTAINER);
     if ( rc != 0 )
         return rc;
 
@@ -166,7 +167,8 @@ static elf_negerrnoval xc_dom_parse_elf_kernel(struct xc_dom_image *dom)
 
     /* parse binary and get xen meta info */
     elf_parse_binary(elf);
-    if ( elf_xen_parse(elf, dom->parms) != 0 )
+    if ( elf_xen_parse(elf, dom->parms,
+                       dom->container_type == XC_DOM_HVM_CONTAINER) != 0 )
     {
         rc = -EINVAL;
         goto out;
diff --git a/tools/libs/guest/xg_dom_hvmloader.c b/tools/libs/guest/xg_dom_hvmloader.c
index 4e6f30858a..ae50d98011 100644
--- a/tools/libs/guest/xg_dom_hvmloader.c
+++ b/tools/libs/guest/xg_dom_hvmloader.c
@@ -73,7 +73,7 @@ static elf_negerrnoval xc_dom_probe_hvm_kernel(struct xc_dom_image *dom)
      * else we might be trying to load a PV kernel.
      */
     elf_parse_binary(&elf);
-    rc = elf_xen_parse(&elf, dom->parms);
+    rc = elf_xen_parse(&elf, dom->parms, true);
     if ( rc == 0 )
         return -EINVAL;
 
diff --git a/xen/arch/x86/hvm/dom0_build.c b/xen/arch/x86/hvm/dom0_build.c
index 878dc1d808..c24b9efdb0 100644
--- a/xen/arch/x86/hvm/dom0_build.c
+++ b/xen/arch/x86/hvm/dom0_build.c
@@ -561,7 +561,7 @@ static int __init pvh_load_kernel(struct domain *d, const module_t *image,
     elf_set_verbose(&elf);
 #endif
     elf_parse_binary(&elf);
-    if ( (rc = elf_xen_parse(&elf, &parms)) != 0 )
+    if ( (rc = elf_xen_parse(&elf, &parms, true)) != 0 )
     {
         printk("Unable to parse kernel for ELFNOTES\n");
         return rc;
diff --git a/xen/arch/x86/pv/dom0_build.c b/xen/arch/x86/pv/dom0_build.c
index e0801a9e6d..af47615b22 100644
--- a/xen/arch/x86/pv/dom0_build.c
+++ b/xen/arch/x86/pv/dom0_build.c
@@ -353,7 +353,7 @@ int __init dom0_construct_pv(struct domain *d,
         elf_set_verbose(&elf);
 
     elf_parse_binary(&elf);
-    if ( (rc = elf_xen_parse(&elf, &parms)) != 0 )
+    if ( (rc = elf_xen_parse(&elf, &parms, false)) != 0 )
         goto out;
 
     /* compatibility check */
diff --git a/xen/common/libelf/libelf-dominfo.c b/xen/common/libelf/libelf-dominfo.c
index 69c94b6f3b..bd295a9b7e 100644
--- a/xen/common/libelf/libelf-dominfo.c
+++ b/xen/common/libelf/libelf-dominfo.c
@@ -499,7 +499,7 @@ static elf_errorstatus elf_xen_addr_calc_check(struct elf_binary *elf,
 /* glue it all together ...                                                 */
 
 elf_errorstatus elf_xen_parse(struct elf_binary *elf,
-                  struct elf_dom_parms *parms)
+                  struct elf_dom_parms *parms, bool hvm)
 {
     ELF_HANDLE_DECL(elf_shdr) shdr;
     ELF_HANDLE_DECL(elf_phdr) phdr;
@@ -577,10 +577,8 @@ elf_errorstatus elf_xen_parse(struct elf_binary *elf,
 
     }
 
-    /*
-     * Finally fall back to the __xen_guest section.
-     */
-    if ( xen_elfnotes == 0 )
+    /* Finally fall back to the __xen_guest section for PV guests only. */
+    if ( xen_elfnotes == 0 && !hvm )
     {
         shdr = elf_shdr_by_name(elf, "__xen_guest");
         if ( ELF_HANDLE_VALID(shdr) )
diff --git a/xen/include/xen/libelf.h b/xen/include/xen/libelf.h
index b73998150f..be47b0cc36 100644
--- a/xen/include/xen/libelf.h
+++ b/xen/include/xen/libelf.h
@@ -454,7 +454,7 @@ int elf_xen_parse_note(struct elf_binary *elf,
 int elf_xen_parse_guest_info(struct elf_binary *elf,
                              struct elf_dom_parms *parms);
 int elf_xen_parse(struct elf_binary *elf,
-                  struct elf_dom_parms *parms);
+                  struct elf_dom_parms *parms, bool hvm);
 
 static inline void *elf_memcpy_unchecked(void *dest, const void *src, size_t n)
     { return memcpy(dest, src, n); }
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri May 28 07:22:26 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 28 May 2021 07:22:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.133822.249286 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lmWp8-0006Ky-9p; Fri, 28 May 2021 07:22:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 133822.249286; Fri, 28 May 2021 07:22:26 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lmWp8-0006Ko-6x; Fri, 28 May 2021 07:22:26 +0000
Received: by outflank-mailman (input) for mailman id 133822;
 Fri, 28 May 2021 07:22:24 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lmWp6-0006Jz-Qr
 for xen-changelog@lists.xenproject.org; Fri, 28 May 2021 07:22:24 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lmWp6-0000TX-Q3
 for xen-changelog@lists.xenproject.org; Fri, 28 May 2021 07:22:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lmWp6-0005tX-P7
 for xen-changelog@lists.xenproject.org; Fri, 28 May 2021 07:22:24 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=4TuhYPi4+S5jVrOL4s3TlzqsDbVy9NoXLThqoORA0+Y=; b=yq2fkF0TryUEnH1I1s5maiheao
	Lg8r0AR8hFBzs3lifj2VHELKCWHrbqZ6A+mW5vJbXlV8jBX05LoQxVXF6ntPwae8wUap9hPD8DvUG
	ZCcpNZ43PpEifxo/emUSgbk0rLM6kPs2UxhAFqZR+BleytHTwLXQNaOCK6ih6kDx8/rM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] libelf: improve PVH elfnote parsing
Message-Id: <E1lmWp6-0005tX-P7@xenbits.xenproject.org>
Date: Fri, 28 May 2021 07:22:24 +0000

commit 632cbaf1243e4b867caf321cfef81517f5cc27ad
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Fri May 28 09:14:44 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri May 28 09:14:44 2021 +0200

    libelf: improve PVH elfnote parsing
    
    Pass an hvm boolean parameter to the elf note checking routines, so that
    better checking can be done in case libelf is dealing with an hvm
    container.
    
    elf_xen_note_check shouldn't return early unless PHYS32_ENTRY is set
    and the container is of type HVM, or else the loader and version
    checks would be avoided for kernels intended to be booted as PV but
    that also have PHYS32_ENTRY set.
    
    Adjust elf_xen_addr_calc_check so that the virtual addresses are
    actually physical ones (by setting virt_base and elf_paddr_offset to
    zero) when the container is of type HVM, as that container is always
    started with paging disabled.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/common/libelf/libelf-dominfo.c | 41 ++++++++++++++++++++++++--------------
 1 file changed, 26 insertions(+), 15 deletions(-)

diff --git a/xen/common/libelf/libelf-dominfo.c b/xen/common/libelf/libelf-dominfo.c
index bd295a9b7e..24d1371dd7 100644
--- a/xen/common/libelf/libelf-dominfo.c
+++ b/xen/common/libelf/libelf-dominfo.c
@@ -360,7 +360,7 @@ elf_errorstatus elf_xen_parse_guest_info(struct elf_binary *elf,
 /* sanity checks                                                            */
 
 static elf_errorstatus elf_xen_note_check(struct elf_binary *elf,
-                              struct elf_dom_parms *parms)
+                              struct elf_dom_parms *parms, bool hvm)
 {
     if ( (ELF_PTRVAL_INVALID(parms->elf_note_start)) &&
          (ELF_PTRVAL_INVALID(parms->guest_info)) )
@@ -382,7 +382,7 @@ static elf_errorstatus elf_xen_note_check(struct elf_binary *elf,
     }
 
     /* PVH only requires one ELF note to be set */
-    if ( parms->phys_entry != UNSET_ADDR32 )
+    if ( parms->phys_entry != UNSET_ADDR32 && hvm )
     {
         elf_msg(elf, "ELF: Found PVH image\n");
         return 0;
@@ -414,7 +414,7 @@ static elf_errorstatus elf_xen_note_check(struct elf_binary *elf,
 }
 
 static elf_errorstatus elf_xen_addr_calc_check(struct elf_binary *elf,
-                                   struct elf_dom_parms *parms)
+                                   struct elf_dom_parms *parms, bool hvm)
 {
     uint64_t virt_offset;
 
@@ -425,12 +425,15 @@ static elf_errorstatus elf_xen_addr_calc_check(struct elf_binary *elf,
         return -1;
     }
 
-    /* Initial guess for virt_base is 0 if it is not explicitly defined. */
-    if ( parms->virt_base == UNSET_ADDR )
+    /*
+     * Initial guess for virt_base is 0 if it is not explicitly defined in the
+     * PV case. For PVH virt_base is forced to 0 because paging is disabled.
+     */
+    if ( parms->virt_base == UNSET_ADDR || hvm )
     {
         parms->virt_base = 0;
-        elf_msg(elf, "ELF: VIRT_BASE unset, using %#" PRIx64 "\n",
-                parms->virt_base);
+        if ( !hvm )
+            elf_msg(elf, "ELF: VIRT_BASE unset, using 0\n");
     }
 
     /*
@@ -441,23 +444,31 @@ static elf_errorstatus elf_xen_addr_calc_check(struct elf_binary *elf,
      *
      * If we are using the modern ELF notes interface then the default
      * is 0.
+     *
+     * For PVH this is forced to 0, as it's already a legacy option for PV.
      */
-    if ( parms->elf_paddr_offset == UNSET_ADDR )
+    if ( parms->elf_paddr_offset == UNSET_ADDR || hvm )
     {
-        if ( parms->elf_note_start )
+        if ( parms->elf_note_start || hvm )
             parms->elf_paddr_offset = 0;
         else
             parms->elf_paddr_offset = parms->virt_base;
-        elf_msg(elf, "ELF_PADDR_OFFSET unset, using %#" PRIx64 "\n",
-                parms->elf_paddr_offset);
+        if ( !hvm )
+            elf_msg(elf, "ELF_PADDR_OFFSET unset, using %#" PRIx64 "\n",
+                    parms->elf_paddr_offset);
     }
 
     virt_offset = parms->virt_base - parms->elf_paddr_offset;
     parms->virt_kstart = elf->pstart + virt_offset;
     parms->virt_kend   = elf->pend   + virt_offset;
 
-    if ( parms->virt_entry == UNSET_ADDR )
-        parms->virt_entry = elf_uval(elf, elf->ehdr, e_entry);
+    if ( parms->virt_entry == UNSET_ADDR || hvm )
+    {
+        if ( parms->phys_entry != UNSET_ADDR32 && hvm )
+            parms->virt_entry = parms->phys_entry;
+        else
+            parms->virt_entry = elf_uval(elf, elf->ehdr, e_entry);
+    }
 
     if ( parms->bsd_symtab )
     {
@@ -592,9 +603,9 @@ elf_errorstatus elf_xen_parse(struct elf_binary *elf,
         }
     }
 
-    if ( elf_xen_note_check(elf, parms) != 0 )
+    if ( elf_xen_note_check(elf, parms, hvm) != 0 )
         return -1;
-    if ( elf_xen_addr_calc_check(elf, parms) != 0 )
+    if ( elf_xen_addr_calc_check(elf, parms, hvm) != 0 )
         return -1;
     return 0;
 }
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri May 28 07:44:07 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 28 May 2021 07:44:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.133832.249301 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lmXA6-0000Li-2t; Fri, 28 May 2021 07:44:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 133832.249301; Fri, 28 May 2021 07:44:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lmXA5-0000La-VG; Fri, 28 May 2021 07:44:05 +0000
Received: by outflank-mailman (input) for mailman id 133832;
 Fri, 28 May 2021 07:44:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lmXA4-0000Kj-Ga
 for xen-changelog@lists.xenproject.org; Fri, 28 May 2021 07:44:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lmXA4-0000pB-EI
 for xen-changelog@lists.xenproject.org; Fri, 28 May 2021 07:44:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lmXA4-0007XS-Cd
 for xen-changelog@lists.xenproject.org; Fri, 28 May 2021 07:44:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=trh/4ESQjk1p3US/ZEGdLXn5XVpsMS6GTF6DnTdo/gE=; b=CcOigmugct62yCVXLYQksMXlFf
	X0gpHvaGjf1Cw6/sSoZdkS93Yk7QLYppU4fAkhtpR2hXWrbiuEBXBl/tkM2t8GRvLKfPJcNyf2U0j
	KEczLwLBcXwJgXOMQDV6f/nzgE4jxDCJzE8+JG+QMTIRCon6eBZB08v0pjICuNxp2wAA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] common: guard iommu symbols with CONFIG_HAS_PASSTHROUGH
Message-Id: <E1lmXA4-0007XS-Cd@xenbits.xenproject.org>
Date: Fri, 28 May 2021 07:44:04 +0000

commit 683d899e4bffca35c5b192ea0662362b0270a695
Author:     Connor Davis <connojdavis@gmail.com>
AuthorDate: Fri May 28 09:42:25 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri May 28 09:42:25 2021 +0200

    common: guard iommu symbols with CONFIG_HAS_PASSTHROUGH
    
    The variables iommu_enabled and iommu_dont_flush_iotlb are defined in
    drivers/passthrough/iommu.c and are referenced in common code, which
    causes the link to fail when !CONFIG_HAS_PASSTHROUGH.
    
    Guard references to these variables in common code so that xen
    builds when !CONFIG_HAS_PASSTHROUGH.
    
    Signed-off-by: Connor Davis <connojdavis@gmail.com>
    [jb: further massage xen/iommu.h adjustment]
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/common/memory.c     | 10 ++++++++++
 xen/include/xen/iommu.h |  4 ++++
 2 files changed, 14 insertions(+)

diff --git a/xen/common/memory.c b/xen/common/memory.c
index b5c70c4b85..72a6b70cb5 100644
--- a/xen/common/memory.c
+++ b/xen/common/memory.c
@@ -294,7 +294,9 @@ int guest_remove_page(struct domain *d, unsigned long gmfn)
     p2m_type_t p2mt;
 #endif
     mfn_t mfn;
+#ifdef CONFIG_HAS_PASSTHROUGH
     bool *dont_flush_p, dont_flush;
+#endif
     int rc;
 
 #ifdef CONFIG_X86
@@ -385,13 +387,17 @@ int guest_remove_page(struct domain *d, unsigned long gmfn)
      * Since we're likely to free the page below, we need to suspend
      * xenmem_add_to_physmap()'s suppressing of IOMMU TLB flushes.
      */
+#ifdef CONFIG_HAS_PASSTHROUGH
     dont_flush_p = &this_cpu(iommu_dont_flush_iotlb);
     dont_flush = *dont_flush_p;
     *dont_flush_p = false;
+#endif
 
     rc = guest_physmap_remove_page(d, _gfn(gmfn), mfn, 0);
 
+#ifdef CONFIG_HAS_PASSTHROUGH
     *dont_flush_p = dont_flush;
+#endif
 
     /*
      * With the lack of an IOMMU on some platforms, domains with DMA-capable
@@ -839,11 +845,13 @@ int xenmem_add_to_physmap(struct domain *d, struct xen_add_to_physmap *xatp,
     xatp->gpfn += start;
     xatp->size -= start;
 
+#ifdef CONFIG_HAS_PASSTHROUGH
     if ( is_iommu_enabled(d) )
     {
        this_cpu(iommu_dont_flush_iotlb) = 1;
        extra.ppage = &pages[0];
     }
+#endif
 
     while ( xatp->size > done )
     {
@@ -868,6 +876,7 @@ int xenmem_add_to_physmap(struct domain *d, struct xen_add_to_physmap *xatp,
         }
     }
 
+#ifdef CONFIG_HAS_PASSTHROUGH
     if ( is_iommu_enabled(d) )
     {
         int ret;
@@ -894,6 +903,7 @@ int xenmem_add_to_physmap(struct domain *d, struct xen_add_to_physmap *xatp,
         if ( unlikely(ret) && rc >= 0 )
             rc = ret;
     }
+#endif
 
     return rc;
 }
diff --git a/xen/include/xen/iommu.h b/xen/include/xen/iommu.h
index 460755df29..03420cbea3 100644
--- a/xen/include/xen/iommu.h
+++ b/xen/include/xen/iommu.h
@@ -51,8 +51,12 @@ static inline bool_t dfn_eq(dfn_t x, dfn_t y)
     return dfn_x(x) == dfn_x(y);
 }
 
+#ifdef CONFIG_HAS_PASSTHROUGH
 extern bool_t iommu_enable, iommu_enabled;
 extern bool force_iommu, iommu_quarantine, iommu_verbose;
+#else
+#define iommu_enabled false
+#endif
 
 #ifdef CONFIG_X86
 extern enum __packed iommu_intremap {
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri May 28 13:55:10 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 28 May 2021 13:55:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.133951.249471 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lmcx5-000815-Rv; Fri, 28 May 2021 13:55:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 133951.249471; Fri, 28 May 2021 13:55:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lmcx5-00080x-Oy; Fri, 28 May 2021 13:55:03 +0000
Received: by outflank-mailman (input) for mailman id 133951;
 Fri, 28 May 2021 13:55:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lmcx3-00080r-U7
 for xen-changelog@lists.xenproject.org; Fri, 28 May 2021 13:55:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lmcx3-0007Za-Sv
 for xen-changelog@lists.xenproject.org; Fri, 28 May 2021 13:55:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lmcx3-0003OW-Rn
 for xen-changelog@lists.xenproject.org; Fri, 28 May 2021 13:55:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=v/YhkaVlHvkBBeqknlejiBUgprK3jtzr7zChYg1kD/g=; b=LK2XHLrfOYOP/GDxNuksONdDU6
	dAncsMIQUxbpJMescTQx9KsTa+VqsFYjwJ5CyXUpQWyN8SvK8jc3/qhCcHFXQKDyMpIEmcOzR45j6
	yt3WMUHOMJ/yTuCqw+pH3/d0W6p+YYqqprFOZ1yg/jVKn/gzMxw/BnBy1F67Xqg6uRWQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] firmware/shim: UNSUPPORTED=n
Message-Id: <E1lmcx3-0003OW-Rn@xenbits.xenproject.org>
Date: Fri, 28 May 2021 13:55:01 +0000

commit b509d4a688d80e802ff580990288ef5e17859df6
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu May 27 14:39:33 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu May 27 14:39:33 2021 +0200

    firmware/shim: UNSUPPORTED=n
    
    We shouldn't default to include any unsupported code in the shim. Mark
    the setting as off, replacing the ARGO specification. This points out
    anomalies with the scheduler configuration: Unsupported schedulers
    better don't default to Y in release builds (like is already the case
    for ARINC653). Without at least the SCHED_NULL adjustments, the shim
    would suddenly build with RTDS as its default scheduler.
    
    As a result, the SCHED_NULL setting can also be dropped from defconfig.
    
    Clearly with the shim defaulting to it, SCHED_NULL must be supported at
    least there.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Dario Faggioli <dfaggioli@suse.com>
---
 SUPPORT.md                            | 3 ++-
 xen/arch/x86/configs/pvshim_defconfig | 3 +--
 xen/common/sched/Kconfig              | 5 +++--
 3 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/SUPPORT.md b/SUPPORT.md
index d0d4fc6f4f..7a53635c9e 100644
--- a/SUPPORT.md
+++ b/SUPPORT.md
@@ -351,9 +351,10 @@ Currently only single-vcpu domains are supported.
 A very simple, very static scheduling policy
 that always schedules the same vCPU(s) on the same pCPU(s).
 It is designed for maximum determinism and minimum overhead
-on embedded platforms.
+on embedded platforms and the x86 PV shim.
 
     Status: Experimental
+    Status, x86/shim: Supported
 
 ### NUMA scheduler affinity
 
diff --git a/xen/arch/x86/configs/pvshim_defconfig b/xen/arch/x86/configs/pvshim_defconfig
index cdf5776610..787376df5a 100644
--- a/xen/arch/x86/configs/pvshim_defconfig
+++ b/xen/arch/x86/configs/pvshim_defconfig
@@ -6,7 +6,6 @@ CONFIG_PV_SHIM=y
 CONFIG_PV_SHIM_EXCLUSIVE=y
 CONFIG_NR_CPUS=32
 CONFIG_EXPERT=y
-CONFIG_SCHED_NULL=y
 # Disable features not used by the PV shim
 # CONFIG_XEN_SHSTK is not set
 # CONFIG_GRANT_TABLE is not set
@@ -15,7 +14,7 @@ CONFIG_SCHED_NULL=y
 # CONFIG_KEXEC is not set
 # CONFIG_XENOPROF is not set
 # CONFIG_XSM is not set
-# CONFIG_ARGO is not set
+# CONFIG_UNSUPPORTED is not set
 # CONFIG_SCHED_CREDIT is not set
 # CONFIG_SCHED_CREDIT2 is not set
 # CONFIG_SCHED_RTDS is not set
diff --git a/xen/common/sched/Kconfig b/xen/common/sched/Kconfig
index 94c9e20139..3d9f9214b8 100644
--- a/xen/common/sched/Kconfig
+++ b/xen/common/sched/Kconfig
@@ -16,7 +16,7 @@ config SCHED_CREDIT2
 
 config SCHED_RTDS
 	bool "RTDS scheduler support (UNSUPPORTED)" if UNSUPPORTED
-	default y
+	default DEBUG
 	---help---
 	  The RTDS scheduler is a soft and firm real-time scheduler for
 	  multicore, targeted for embedded, automotive, graphics and gaming
@@ -31,7 +31,7 @@ config SCHED_ARINC653
 
 config SCHED_NULL
 	bool "Null scheduler support (UNSUPPORTED)" if UNSUPPORTED
-	default y
+	default PV_SHIM || DEBUG
 	---help---
 	  The null scheduler is a static, zero overhead scheduler,
 	  for when there always are less vCPUs than pCPUs, typically
@@ -39,6 +39,7 @@ config SCHED_NULL
 
 choice
 	prompt "Default Scheduler?"
+	default SCHED_NULL_DEFAULT if PV_SHIM_EXCLUSIVE
 	default SCHED_CREDIT2_DEFAULT
 
 	config SCHED_CREDIT_DEFAULT
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri May 28 13:55:12 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 28 May 2021 13:55:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.133952.249475 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lmcxE-00082w-TN; Fri, 28 May 2021 13:55:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 133952.249475; Fri, 28 May 2021 13:55:12 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lmcxE-00082o-QR; Fri, 28 May 2021 13:55:12 +0000
Received: by outflank-mailman (input) for mailman id 133952;
 Fri, 28 May 2021 13:55:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lmcxE-00082g-1K
 for xen-changelog@lists.xenproject.org; Fri, 28 May 2021 13:55:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lmcxE-0007Ze-0W
 for xen-changelog@lists.xenproject.org; Fri, 28 May 2021 13:55:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lmcxD-0003PC-Vq
 for xen-changelog@lists.xenproject.org; Fri, 28 May 2021 13:55:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=/8AJeJzKRALoyxnHaShZwp7jF+p4N1cuFSLEM2lvF68=; b=z5yg8uluiYfUvn3b2WjfYtf6zD
	YUEPbe0OYYCcxulko/ATeeYk8CzABzA0RpxurYyFzyrrvspX9ENyYbPJXB1lScZ2ndsk8UAa0f5D9
	+PSgfvrH8KLoQOsY0gA+M8Ba1mLJj/85Lvt0L7kSZkixzGZaDu6+JUjwBCNcEgj/vsSU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86: make hypervisor build with gcc11
Message-Id: <E1lmcxD-0003PC-Vq@xenbits.xenproject.org>
Date: Fri, 28 May 2021 13:55:11 +0000

commit 722f59d38c710a940ab05e542a83020eb5546dea
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu May 27 14:40:29 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu May 27 14:40:29 2021 +0200

    x86: make hypervisor build with gcc11
    
    Gcc 11 looks to make incorrect assumptions about valid ranges that
    pointers may be used for addressing when they are derived from e.g. a
    plain constant. See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100680.
    
    Utilize RELOC_HIDE() to work around the issue, which for x86 manifests
    in at least
    - mpparse.c:efi_check_config(),
    - tboot.c:tboot_probe(),
    - tboot.c:tboot_gen_frametable_integrity(),
    - x86_emulate.c:x86_emulate() (at -O2 only).
    The last case is particularly odd not just because it only triggers at
    higher optimization levels, but also because it only affects one of at
    least three similar constructs. Various "note" diagnostics claim the
    valid index range to be [0, 2⁶³-1].
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Tested-by: Jason Andryuk <jandryuk@gmail.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 tools/tests/x86_emulator/x86-emulate.c | 7 +++++++
 xen/arch/x86/x86_emulate/x86_emulate.c | 2 +-
 xen/include/asm-x86/fixmap.h           | 2 +-
 xen/include/xen/compiler.h             | 6 ++++++
 xen/include/xen/pdx.h                  | 2 +-
 5 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/tools/tests/x86_emulator/x86-emulate.c b/tools/tests/x86_emulator/x86-emulate.c
index 07f892dbbb..ea286d6ad8 100644
--- a/tools/tests/x86_emulator/x86-emulate.c
+++ b/tools/tests/x86_emulator/x86-emulate.c
@@ -8,6 +8,13 @@
 
 #define ERR_PTR(val) NULL
 
+/* See gcc bug 100680, but here don't bother making this version dependent. */
+#define gcc11_wrap(x) ({                  \
+    unsigned long x_;                     \
+    __asm__ ( "" : "=g" (x_) : "0" (x) ); \
+    (typeof(x))x_;                        \
+})
+
 #define cpu_has_amd_erratum(nr) 0
 #define cpu_has_mpx false
 #define read_bndcfgu() 0
diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c
index c25d88d0d8..31fdec030c 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -726,7 +726,7 @@ union vex {
 #define copy_VEX(ptr, vex) ({ \
     if ( !mode_64bit() ) \
         (vex).reg |= 8; \
-    (ptr)[0 - PFX_BYTES] = ext < ext_8f08 ? 0xc4 : 0x8f; \
+    gcc11_wrap(ptr)[0 - PFX_BYTES] = ext < ext_8f08 ? 0xc4 : 0x8f; \
     (ptr)[1 - PFX_BYTES] = (vex).raw[0]; \
     (ptr)[2 - PFX_BYTES] = (vex).raw[1]; \
     container_of((ptr) + 1 - PFX_BYTES, typeof(vex), raw[0]); \
diff --git a/xen/include/asm-x86/fixmap.h b/xen/include/asm-x86/fixmap.h
index 0db314baeb..20746afd0a 100644
--- a/xen/include/asm-x86/fixmap.h
+++ b/xen/include/asm-x86/fixmap.h
@@ -78,7 +78,7 @@ extern void __set_fixmap(
 
 #define clear_fixmap(idx) __set_fixmap(idx, 0, 0)
 
-#define __fix_to_virt(x) (FIXADDR_TOP - ((x) << PAGE_SHIFT))
+#define __fix_to_virt(x) gcc11_wrap(FIXADDR_TOP - ((x) << PAGE_SHIFT))
 #define __virt_to_fix(x) ((FIXADDR_TOP - ((x)&PAGE_MASK)) >> PAGE_SHIFT)
 
 #define fix_to_virt(x)   ((void *)__fix_to_virt(x))
diff --git a/xen/include/xen/compiler.h b/xen/include/xen/compiler.h
index 17cf00e1ec..696c7eb89e 100644
--- a/xen/include/xen/compiler.h
+++ b/xen/include/xen/compiler.h
@@ -140,6 +140,12 @@
     __asm__ ("" : "=r"(__ptr) : "0"(ptr));      \
     (typeof(ptr)) (__ptr + (off)); })
 
+#if CONFIG_GCC_VERSION >= 110000 /* See gcc bug 100680. */
+# define gcc11_wrap(x) RELOC_HIDE(x, 0)
+#else
+# define gcc11_wrap(x) (x)
+#endif
+
 #ifdef __GCC_ASM_FLAG_OUTPUTS__
 # define ASM_FLAG_OUT(yes, no) yes
 #else
diff --git a/xen/include/xen/pdx.h b/xen/include/xen/pdx.h
index 770fadc06c..9fcfb0ce52 100644
--- a/xen/include/xen/pdx.h
+++ b/xen/include/xen/pdx.h
@@ -19,7 +19,7 @@ extern u64 pdx_region_mask(u64 base, u64 len);
 extern void set_pdx_range(unsigned long smfn, unsigned long emfn);
 
 #define page_to_pdx(pg)  ((pg) - frame_table)
-#define pdx_to_page(pdx) (frame_table + (pdx))
+#define pdx_to_page(pdx) gcc11_wrap(frame_table + (pdx))
 
 bool __mfn_valid(unsigned long mfn);
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri May 28 13:55:23 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 28 May 2021 13:55:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.133953.249479 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lmcxO-00086F-VS; Fri, 28 May 2021 13:55:22 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 133953.249479; Fri, 28 May 2021 13:55:22 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lmcxO-000865-Rx; Fri, 28 May 2021 13:55:22 +0000
Received: by outflank-mailman (input) for mailman id 133953;
 Fri, 28 May 2021 13:55:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lmcxO-00085p-4o
 for xen-changelog@lists.xenproject.org; Fri, 28 May 2021 13:55:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lmcxO-0007Zp-40
 for xen-changelog@lists.xenproject.org; Fri, 28 May 2021 13:55:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lmcxO-0003Q4-2x
 for xen-changelog@lists.xenproject.org; Fri, 28 May 2021 13:55:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=gGhjPCBGssn8fVqtUM1WslVinblEVVqKLvZZM4QHbHo=; b=KnKITrup/1gK4fgtuollOq4lft
	lH7zSkB+0F4wRMCGWmeTqP9ueA5Fd/1Ba/veFx70UTpiJpb39VhrebniCvONLlL/TYCma7h6XEzjS
	DcTkDz80fDatTjTBBmY0jX1+BrvXGWUfJeordw6pDaJ4fWK2+hJjQQ8EjG6nzeV00k+E=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/cpuid: Rework HLE and RTM handling
Message-Id: <E1lmcxO-0003Q4-2x@xenbits.xenproject.org>
Date: Fri, 28 May 2021 13:55:22 +0000

commit 8fe24090d940d760145ccd5e234290be7418b175
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu May 20 19:48:39 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu May 27 19:34:00 2021 +0100

    x86/cpuid: Rework HLE and RTM handling
    
    The TAA mitigation offered the option to hide the HLE and RTM CPUID bits,
    which has caused some migration compatibility problems.
    
    These two bits are special.  Annotate them with ! to emphasise this point.
    
    Hardware Lock Elision (HLE) may or may not be visible in CPUID, but is
    disabled in microcode on all CPUs, and has been removed from the architecture.
    Do not advertise it to VMs by default.
    
    Restricted Transactional Memory (RTM) may or may not be visible in CPUID, and
    may or may not be configured in force-abort mode.  Have tsx_init() note
    whether RTM has been configured into force-abort mode, so
    guest_common_feature_adjustments() can conditionally hide it from VMs by
    default.
    
    The host policy values for HLE/RTM may or may not be set, depending on any
    previous running kernel's choice of visibility, and Xen's choice.  TSX is
    available on any CPU which enumerates a TSX-hiding mechanism, so instead of
    doing a two-step to clobber any hiding, scan CPUID, then set the visibility,
    just force visibility of the bits in the first place.
    
    With the HLE/RTM bits now unilaterally visible in the host policy,
    xc_cpuid_apply_policy() can construct a more appropriate policy out of thin
    air for pre-4.13 VMs with no CPUID data in their migration stream, and
    specifically one where HLE/RTM doesn't potentially disappear behind the back
    of a running VM.
    
    Fixes: 8c4330818f6 ("x86/spec-ctrl: Mitigate the TSX Asynchronous Abort sidechannel")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 tools/libs/guest/xg_cpuid_x86.c             |  2 ++
 xen/arch/x86/cpuid.c                        | 24 ++++++++++------------
 xen/arch/x86/spec_ctrl.c                    |  3 ---
 xen/arch/x86/tsx.c                          | 31 +++++++++++++++++++++++++++--
 xen/include/asm-x86/processor.h             |  1 +
 xen/include/public/arch-x86/cpufeatureset.h |  4 ++--
 6 files changed, 44 insertions(+), 21 deletions(-)

diff --git a/tools/libs/guest/xg_cpuid_x86.c b/tools/libs/guest/xg_cpuid_x86.c
index 1ebc108213..ec5a47fde4 100644
--- a/tools/libs/guest/xg_cpuid_x86.c
+++ b/tools/libs/guest/xg_cpuid_x86.c
@@ -511,6 +511,8 @@ int xc_cpuid_apply_policy(xc_interface *xch, uint32_t domid, bool restore,
          * so migrated-in VM's don't risk seeing features disappearing.
          */
         p->basic.rdrand = test_bit(X86_FEATURE_RDRAND, host_featureset);
+        p->feat.hle = test_bit(X86_FEATURE_HLE, host_featureset);
+        p->feat.rtm = test_bit(X86_FEATURE_RTM, host_featureset);
 
         if ( di.hvm )
         {
diff --git a/xen/arch/x86/cpuid.c b/xen/arch/x86/cpuid.c
index 752bf244ea..55a7b16342 100644
--- a/xen/arch/x86/cpuid.c
+++ b/xen/arch/x86/cpuid.c
@@ -375,6 +375,16 @@ static void __init guest_common_default_feature_adjustments(uint32_t *fs)
          boot_cpu_data.x86 == 6 && boot_cpu_data.x86_model == 0x3a &&
          cpu_has_rdrand && !is_forced_cpu_cap(X86_FEATURE_RDRAND) )
         __clear_bit(X86_FEATURE_RDRAND, fs);
+
+    /*
+     * On certain hardware, speculative or errata workarounds can result in
+     * TSX being placed in "force-abort" mode, where it doesn't actually
+     * function as expected, but is technically compatible with the ISA.
+     *
+     * Do not advertise RTM to guests by default if it won't actually work.
+     */
+    if ( rtm_disabled )
+        __clear_bit(X86_FEATURE_RTM, fs);
 }
 
 static void __init guest_common_feature_adjustments(uint32_t *fs)
@@ -652,20 +662,6 @@ void recalculate_cpuid_policy(struct domain *d)
             __clear_bit(X86_FEATURE_SYSCALL, max_fs);
     }
 
-    /*
-     * On hardware with MSR_TSX_CTRL, the admin may have elected to disable
-     * TSX and hide the feature bits.  Migrating-in VMs may have been booted
-     * pre-mitigation when the TSX features were visbile.
-     *
-     * This situation is compatible (albeit with a perf hit to any TSX code in
-     * the guest), so allow the feature bits to remain set.
-     */
-    if ( cpu_has_tsx_ctrl )
-    {
-        __set_bit(X86_FEATURE_HLE, max_fs);
-        __set_bit(X86_FEATURE_RTM, max_fs);
-    }
-
     /* Clamp the toolstacks choices to reality. */
     for ( i = 0; i < ARRAY_SIZE(fs); i++ )
         fs[i] &= max_fs[i];
diff --git a/xen/arch/x86/spec_ctrl.c b/xen/arch/x86/spec_ctrl.c
index cd05f42394..f2782b2d55 100644
--- a/xen/arch/x86/spec_ctrl.c
+++ b/xen/arch/x86/spec_ctrl.c
@@ -1158,9 +1158,6 @@ void __init init_speculation_mitigations(void)
          ((hw_smt_enabled && opt_smt) ||
           !boot_cpu_has(X86_FEATURE_SC_VERW_IDLE)) )
     {
-        setup_clear_cpu_cap(X86_FEATURE_HLE);
-        setup_clear_cpu_cap(X86_FEATURE_RTM);
-
         opt_tsx = 0;
         tsx_init();
     }
diff --git a/xen/arch/x86/tsx.c b/xen/arch/x86/tsx.c
index 39e483640a..e09e819dce 100644
--- a/xen/arch/x86/tsx.c
+++ b/xen/arch/x86/tsx.c
@@ -15,6 +15,7 @@
  */
 int8_t __read_mostly opt_tsx = -1;
 int8_t __read_mostly cpu_has_tsx_ctrl = -1;
+bool __read_mostly rtm_disabled;
 
 static int __init parse_tsx(const char *s)
 {
@@ -45,6 +46,30 @@ void tsx_init(void)
             rdmsrl(MSR_ARCH_CAPABILITIES, caps);
 
         cpu_has_tsx_ctrl = !!(caps & ARCH_CAPS_TSX_CTRL);
+
+        /*
+         * The TSX features (HLE/RTM) are handled specially.  They both
+         * enumerate features but, on certain parts, have mechanisms to be
+         * hidden without disrupting running software.
+         *
+         * At the moment, we're running in an unknown context (WRT hiding -
+         * particularly if another fully fledged kernel ran before us) and
+         * depending on user settings, may elect to continue hiding them from
+         * native CPUID instructions.
+         *
+         * Xen doesn't use TSX itself, but use cpu_has_{hle,rtm} for various
+         * system reasons, mostly errata detection, so the meaning is more
+         * useful as "TSX infrastructure available", as opposed to "features
+         * advertised and working".
+         *
+         * Force the features to be visible in Xen's view if we see any of the
+         * infrastructure capable of hiding them.
+         */
+        if ( cpu_has_tsx_ctrl )
+        {
+            setup_force_cpu_cap(X86_FEATURE_HLE);
+            setup_force_cpu_cap(X86_FEATURE_RTM);
+        }
     }
 
     if ( cpu_has_tsx_ctrl )
@@ -53,9 +78,11 @@ void tsx_init(void)
 
         rdmsrl(MSR_TSX_CTRL, val);
 
+        /* Check bottom bit only.  Higher bits are various sentinels. */
+        rtm_disabled = !(opt_tsx & 1);
+
         val &= ~(TSX_CTRL_RTM_DISABLE | TSX_CTRL_CPUID_CLEAR);
-        /* Check bottom bit only.  Higher bits are various sentinals. */
-        if ( !(opt_tsx & 1) )
+        if ( rtm_disabled )
             val |= TSX_CTRL_RTM_DISABLE | TSX_CTRL_CPUID_CLEAR;
 
         wrmsrl(MSR_TSX_CTRL, val);
diff --git a/xen/include/asm-x86/processor.h b/xen/include/asm-x86/processor.h
index 83143d4df8..bc4dc69253 100644
--- a/xen/include/asm-x86/processor.h
+++ b/xen/include/asm-x86/processor.h
@@ -627,6 +627,7 @@ static inline uint8_t get_cpu_family(uint32_t raw, uint8_t *model,
 }
 
 extern int8_t opt_tsx, cpu_has_tsx_ctrl;
+extern bool rtm_disabled;
 void tsx_init(void);
 
 enum ap_boot_method {
diff --git a/xen/include/public/arch-x86/cpufeatureset.h b/xen/include/public/arch-x86/cpufeatureset.h
index c42f56bdd4..b65af42436 100644
--- a/xen/include/public/arch-x86/cpufeatureset.h
+++ b/xen/include/public/arch-x86/cpufeatureset.h
@@ -197,14 +197,14 @@ XEN_CPUFEATURE(FSGSBASE,      5*32+ 0) /*A  {RD,WR}{FS,GS}BASE instructions */
 XEN_CPUFEATURE(TSC_ADJUST,    5*32+ 1) /*S  TSC_ADJUST MSR available */
 XEN_CPUFEATURE(SGX,           5*32+ 2) /*   Software Guard extensions */
 XEN_CPUFEATURE(BMI1,          5*32+ 3) /*A  1st bit manipulation extensions */
-XEN_CPUFEATURE(HLE,           5*32+ 4) /*A  Hardware Lock Elision */
+XEN_CPUFEATURE(HLE,           5*32+ 4) /*!a Hardware Lock Elision */
 XEN_CPUFEATURE(AVX2,          5*32+ 5) /*A  AVX2 instructions */
 XEN_CPUFEATURE(FDP_EXCP_ONLY, 5*32+ 6) /*!  x87 FDP only updated on exception. */
 XEN_CPUFEATURE(SMEP,          5*32+ 7) /*S  Supervisor Mode Execution Protection */
 XEN_CPUFEATURE(BMI2,          5*32+ 8) /*A  2nd bit manipulation extensions */
 XEN_CPUFEATURE(ERMS,          5*32+ 9) /*A  Enhanced REP MOVSB/STOSB */
 XEN_CPUFEATURE(INVPCID,       5*32+10) /*H  Invalidate Process Context ID */
-XEN_CPUFEATURE(RTM,           5*32+11) /*A  Restricted Transactional Memory */
+XEN_CPUFEATURE(RTM,           5*32+11) /*!A Restricted Transactional Memory */
 XEN_CPUFEATURE(PQM,           5*32+12) /*   Platform QoS Monitoring */
 XEN_CPUFEATURE(NO_FPU_SEL,    5*32+13) /*!  FPU CS/DS stored as zero */
 XEN_CPUFEATURE(MPX,           5*32+14) /*s  Memory Protection Extensions */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri May 28 13:55:33 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 28 May 2021 13:55:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.133954.249483 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lmcxZ-0008A4-0O; Fri, 28 May 2021 13:55:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 133954.249483; Fri, 28 May 2021 13:55:32 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lmcxY-00089v-TY; Fri, 28 May 2021 13:55:32 +0000
Received: by outflank-mailman (input) for mailman id 133954;
 Fri, 28 May 2021 13:55:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lmcxY-00089j-8M
 for xen-changelog@lists.xenproject.org; Fri, 28 May 2021 13:55:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lmcxY-0007a5-7Z
 for xen-changelog@lists.xenproject.org; Fri, 28 May 2021 13:55:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lmcxY-0003Qn-6Y
 for xen-changelog@lists.xenproject.org; Fri, 28 May 2021 13:55:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=8W86zGz8nD/YJtXpK6fRtu6TDBAH53eFzOu/oOnGCVY=; b=N2EZ3xTfmdFnesV3RH5JFtt7Bf
	bN7st5d/E3PFMHD50L/54L07yKFfNrQJGe1cAUFAOuMKjCGE6GGxc0LydsLpWopt+SUuqD4PrlDRh
	wLbxqiMAfQMAIXMotiHk1itshIudqQ3gj0SZuyjEgeXcfntgmmjKg5rfwncJtqrV6Ofg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/tsx: Minor cleanup and improvements
Message-Id: <E1lmcxY-0003Qn-6Y@xenbits.xenproject.org>
Date: Fri, 28 May 2021 13:55:32 +0000

commit 3670abcaf0324f2aedba0c4dc7939072b27efa1d
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue May 18 14:53:56 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu May 27 19:34:00 2021 +0100

    x86/tsx: Minor cleanup and improvements
    
     * Introduce cpu_has_arch_caps and replace boot_cpu_has(X86_FEATURE_ARCH_CAPS)
     * Read CPUID data into the appropriate boot_cpu_data.x86_capability[]
       element, as subsequent changes are going to need more cpu_has_* logic.
     * Use the hi/lo MSR helpers, which substantially improves code generation.
    
    No practical change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/cpuid.c             |  2 +-
 xen/arch/x86/hvm/vmx/vmx.c       |  2 +-
 xen/arch/x86/msr.c               |  2 +-
 xen/arch/x86/spec_ctrl.c         |  2 +-
 xen/arch/x86/tsx.c               | 21 ++++++++++++---------
 xen/include/asm-x86/cpufeature.h |  1 +
 6 files changed, 17 insertions(+), 13 deletions(-)

diff --git a/xen/arch/x86/cpuid.c b/xen/arch/x86/cpuid.c
index 55a7b16342..f3c8950aa3 100644
--- a/xen/arch/x86/cpuid.c
+++ b/xen/arch/x86/cpuid.c
@@ -747,7 +747,7 @@ int init_domain_cpuid_policy(struct domain *d)
      * so dom0 can turn off workarounds as appropriate.  Temporary, until the
      * domain policy logic gains a better understanding of MSRs.
      */
-    if ( is_hardware_domain(d) && boot_cpu_has(X86_FEATURE_ARCH_CAPS) )
+    if ( is_hardware_domain(d) && cpu_has_arch_caps )
         p->feat.arch_caps = true;
 
     d->arch.cpuid = p;
diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index 1450fd1991..7e3e67fdc3 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -2566,7 +2566,7 @@ static bool __init has_if_pschange_mc(void)
     if ( cpu_has_hypervisor )
         return false;
 
-    if ( boot_cpu_has(X86_FEATURE_ARCH_CAPS) )
+    if ( cpu_has_arch_caps )
         rdmsrl(MSR_ARCH_CAPABILITIES, caps);
 
     if ( caps & ARCH_CAPS_IF_PSCHANGE_MC_NO )
diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
index c3a988bd11..374f92b2c5 100644
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -136,7 +136,7 @@ int init_domain_msr_policy(struct domain *d)
      * so dom0 can turn off workarounds as appropriate.  Temporary, until the
      * domain policy logic gains a better understanding of MSRs.
      */
-    if ( is_hardware_domain(d) && boot_cpu_has(X86_FEATURE_ARCH_CAPS) )
+    if ( is_hardware_domain(d) && cpu_has_arch_caps )
     {
         uint64_t val;
 
diff --git a/xen/arch/x86/spec_ctrl.c b/xen/arch/x86/spec_ctrl.c
index f2782b2d55..739b7913ff 100644
--- a/xen/arch/x86/spec_ctrl.c
+++ b/xen/arch/x86/spec_ctrl.c
@@ -885,7 +885,7 @@ void __init init_speculation_mitigations(void)
     bool cpu_has_bug_taa;
     uint64_t caps = 0;
 
-    if ( boot_cpu_has(X86_FEATURE_ARCH_CAPS) )
+    if ( cpu_has_arch_caps )
         rdmsrl(MSR_ARCH_CAPABILITIES, caps);
 
     hw_smt_enabled = check_smt_enabled();
diff --git a/xen/arch/x86/tsx.c b/xen/arch/x86/tsx.c
index e09e819dce..98ecb71a4a 100644
--- a/xen/arch/x86/tsx.c
+++ b/xen/arch/x86/tsx.c
@@ -34,15 +34,18 @@ void tsx_init(void)
 {
     /*
      * This function is first called between microcode being loaded, and CPUID
-     * being scanned generally.  Calculate from raw data whether MSR_TSX_CTRL
-     * is available.
+     * being scanned generally.  Read into boot_cpu_data.x86_capability[] for
+     * the cpu_has_* bits we care about using here.
      */
     if ( unlikely(cpu_has_tsx_ctrl < 0) )
     {
         uint64_t caps = 0;
 
-        if ( boot_cpu_data.cpuid_level >= 7 &&
-             (cpuid_count_edx(7, 0) & cpufeat_mask(X86_FEATURE_ARCH_CAPS)) )
+        if ( boot_cpu_data.cpuid_level >= 7 )
+            boot_cpu_data.x86_capability[cpufeat_word(X86_FEATURE_ARCH_CAPS)]
+                = cpuid_count_edx(7, 0);
+
+        if ( cpu_has_arch_caps )
             rdmsrl(MSR_ARCH_CAPABILITIES, caps);
 
         cpu_has_tsx_ctrl = !!(caps & ARCH_CAPS_TSX_CTRL);
@@ -74,18 +77,18 @@ void tsx_init(void)
 
     if ( cpu_has_tsx_ctrl )
     {
-        uint64_t val;
+        uint32_t hi, lo;
 
-        rdmsrl(MSR_TSX_CTRL, val);
+        rdmsr(MSR_TSX_CTRL, lo, hi);
 
         /* Check bottom bit only.  Higher bits are various sentinels. */
         rtm_disabled = !(opt_tsx & 1);
 
-        val &= ~(TSX_CTRL_RTM_DISABLE | TSX_CTRL_CPUID_CLEAR);
+        lo &= ~(TSX_CTRL_RTM_DISABLE | TSX_CTRL_CPUID_CLEAR);
         if ( rtm_disabled )
-            val |= TSX_CTRL_RTM_DISABLE | TSX_CTRL_CPUID_CLEAR;
+            lo |= TSX_CTRL_RTM_DISABLE | TSX_CTRL_CPUID_CLEAR;
 
-        wrmsrl(MSR_TSX_CTRL, val);
+        wrmsr(MSR_TSX_CTRL, lo, hi);
     }
     else if ( opt_tsx >= 0 )
         printk_once(XENLOG_WARNING
diff --git a/xen/include/asm-x86/cpufeature.h b/xen/include/asm-x86/cpufeature.h
index 33b2257888..9f5ae3aa0d 100644
--- a/xen/include/asm-x86/cpufeature.h
+++ b/xen/include/asm-x86/cpufeature.h
@@ -133,6 +133,7 @@
 #define cpu_has_avx512_vp2intersect boot_cpu_has(X86_FEATURE_AVX512_VP2INTERSECT)
 #define cpu_has_tsx_force_abort boot_cpu_has(X86_FEATURE_TSX_FORCE_ABORT)
 #define cpu_has_serialize       boot_cpu_has(X86_FEATURE_SERIALIZE)
+#define cpu_has_arch_caps       boot_cpu_has(X86_FEATURE_ARCH_CAPS)
 
 /* CPUID level 0x00000007:1.eax */
 #define cpu_has_avx_vnni        boot_cpu_has(X86_FEATURE_AVX_VNNI)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri May 28 13:55:43 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 28 May 2021 13:55:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.133955.249487 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lmcxj-0008Dx-3X; Fri, 28 May 2021 13:55:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 133955.249487; Fri, 28 May 2021 13:55:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lmcxj-0008Dn-0J; Fri, 28 May 2021 13:55:43 +0000
Received: by outflank-mailman (input) for mailman id 133955;
 Fri, 28 May 2021 13:55:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lmcxi-0008Dg-Bc
 for xen-changelog@lists.xenproject.org; Fri, 28 May 2021 13:55:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lmcxi-0007aF-Ao
 for xen-changelog@lists.xenproject.org; Fri, 28 May 2021 13:55:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lmcxi-0003RU-9t
 for xen-changelog@lists.xenproject.org; Fri, 28 May 2021 13:55:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=T70Cb9hasdZ0Tw9eqz8cHXgZDUMBzazZNP9NuUIxmLo=; b=LVEuEeQRoNr1R5ykbyzzKFFp45
	1+BPQGh+HFiBLxjbVl3ipAC1o7W8LXzmpY4R+9x7Oob/kpDgBP1BA7oEf6eztHqzCS9rJxF59aS7Q
	LlFXeDHrf4wUVnDd0PK53GC8MlqJFtIl98bMCKA0E5oGPd56cGcsAHpHVmPb+LLwg7I0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/tsx: Deprecate vpmu=rtm-abort and use tsx=<bool> instead
Message-Id: <E1lmcxi-0003RU-9t@xenbits.xenproject.org>
Date: Fri, 28 May 2021 13:55:42 +0000

commit 9fdcf851689cb2a9501d3947cb5d767d9c7797e8
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu May 20 19:16:11 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu May 27 19:34:00 2021 +0100

    x86/tsx: Deprecate vpmu=rtm-abort and use tsx=<bool> instead
    
    This reuses the rtm_disable infrastructure, so CPUID derivation works properly
    when TSX is disabled in favour of working PCR3.
    
    vpmu= is not a supported feature, and having this functionality under tsx=
    centralises all TSX handling.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 docs/misc/xen-command-line.pandoc | 40 +++++++++++++++---------------
 xen/arch/x86/cpu/intel.c          |  3 ---
 xen/arch/x86/cpu/vpmu.c           |  4 +--
 xen/arch/x86/tsx.c                | 51 +++++++++++++++++++++++++++++++++++++--
 xen/include/asm-x86/vpmu.h        |  1 -
 5 files changed, 70 insertions(+), 29 deletions(-)

diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc
index c32a397a12..1fae872626 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -2296,14 +2296,21 @@ pages) must also be specified via the tbuf_size parameter.
 
 Controls for the use of Transactional Synchronization eXtensions.
 
-On Intel parts released in Q3 2019 (with updated microcode), and future parts,
-a control has been introduced which allows TSX to be turned off.
+Several microcode updates are relevant:
 
-On systems with the ability to turn TSX off, this boolean offers system wide
-control of whether TSX is enabled or disabled.
+ * March 2019, fixing the TSX memory ordering errata on all TSX-enabled CPUs
+   to date.  Introduced MSR_TSX_FORCE_ABORT on SKL/SKX/KBL/WHL/CFL parts.  The
+   errata workaround uses Performance Counter 3, so the user can select
+   between working TSX and working perfcounters.
+
+ * November 2019, fixing the TSX Async Abort speculative vulnerability.
+   Introduced MSR_TSX_CTRL on all TSX-enabled MDS_NO parts to date,
+   CLX/WHL-R/CFL-R, with the controls becoming architectural moving forward
+   and formally retiring HLE from the architecture.  The user can disable TSX
+   to mitigate TAA, and elect to hide the HLE/RTM CPUID bits.
 
-On parts vulnerable to CVE-2019-11135 / TSX Asynchronous Abort, the following
-logic applies:
+On systems with the ability to configure TSX, this boolean offers system wide
+control of whether TSX is enabled or disabled.
 
  * An explicit `tsx=` choice is honoured, even if it is `true` and would
    result in a vulnerable system.
@@ -2311,10 +2318,14 @@ logic applies:
  * When no explicit `tsx=` choice is given, parts vulnerable to TAA will be
    mitigated by disabling TSX, as this is the lowest overhead option.
 
- * If the use of TSX is important, the more expensive TAA mitigations can be
+   If the use of TSX is important, the more expensive TAA mitigations can be
    opted in to with `smt=0 spec-ctrl=md-clear`, at which point TSX will remain
    active by default.
 
+ * When no explicit `tsx=` option is given, parts susceptible to the memory
+   ordering errata default to `true` to enable working TSX.  Alternatively,
+   selecting `tsx=0` will disable TSX and restore PCR3 to a working state.
+
 ### ucode
 > `= List of [ <integer> | scan=<bool>, nmi=<bool>, allow-same=<bool> ]`
 
@@ -2456,20 +2467,7 @@ provide access to a wealth of low level processor information.
 
 *   The `arch` option allows access to the pre-defined architectural events.
 
-*   The `rtm-abort` boolean controls a trade-off between working Restricted
-    Transactional Memory, and working performance counters.
-
-    All processors released to date (Q1 2019) supporting Transactional Memory
-    Extensions suffer an erratum which has been addressed in microcode.
-
-    Processors based on the Skylake microarchitecture with up-to-date
-    microcode internally use performance counter 3 to work around the erratum.
-    A consequence is that the counter gets reprogrammed whenever an `XBEGIN`
-    instruction is executed.
-
-    An alternative mode exists where PCR3 behaves as before, at the cost of
-    `XBEGIN` unconditionally aborting.  Enabling `rtm-abort` mode will
-    activate this alternative mode.
+*   The `rtm-abort` boolean has been superseded.  Use `tsx=0` instead.
 
 *Warning:*
 As the virtualisation is not 100% safe, don't use the vpmu flag on
diff --git a/xen/arch/x86/cpu/intel.c b/xen/arch/x86/cpu/intel.c
index 37439071d9..abf8e206d7 100644
--- a/xen/arch/x86/cpu/intel.c
+++ b/xen/arch/x86/cpu/intel.c
@@ -356,9 +356,6 @@ static void Intel_errata_workarounds(struct cpuinfo_x86 *c)
 	    (c->x86_model == 29 || c->x86_model == 46 || c->x86_model == 47))
 		__set_bit(X86_FEATURE_CLFLUSH_MONITOR, c->x86_capability);
 
-	if (cpu_has_tsx_force_abort && opt_rtm_abort)
-		wrmsrl(MSR_TSX_FORCE_ABORT, TSX_FORCE_ABORT_RTM);
-
 	probe_c3_errata(c);
 }
 
diff --git a/xen/arch/x86/cpu/vpmu.c b/xen/arch/x86/cpu/vpmu.c
index d8659c63f8..16e91a3694 100644
--- a/xen/arch/x86/cpu/vpmu.c
+++ b/xen/arch/x86/cpu/vpmu.c
@@ -49,7 +49,6 @@ CHECK_pmu_params;
 static unsigned int __read_mostly opt_vpmu_enabled;
 unsigned int __read_mostly vpmu_mode = XENPMU_MODE_OFF;
 unsigned int __read_mostly vpmu_features = 0;
-bool __read_mostly opt_rtm_abort;
 
 static DEFINE_SPINLOCK(vpmu_lock);
 static unsigned vpmu_count;
@@ -79,7 +78,8 @@ static int __init parse_vpmu_params(const char *s)
         else if ( !cmdline_strcmp(s, "arch") )
             vpmu_features |= XENPMU_FEATURE_ARCH_ONLY;
         else if ( (val = parse_boolean("rtm-abort", s, ss)) >= 0 )
-            opt_rtm_abort = val;
+            printk(XENLOG_WARNING
+                   "'rtm-abort=<bool>' superseded.  Use 'tsx=<bool>' instead\n");
         else
             rc = -EINVAL;
 
diff --git a/xen/arch/x86/tsx.c b/xen/arch/x86/tsx.c
index 98ecb71a4a..338191df7f 100644
--- a/xen/arch/x86/tsx.c
+++ b/xen/arch/x86/tsx.c
@@ -6,7 +6,9 @@
  * Valid values:
  *   1 => Explicit tsx=1
  *   0 => Explicit tsx=0
- *  -1 => Default, implicit tsx=1, may change to 0 to mitigate TAA
+ *  -1 => Default, altered to 0/1 (if unspecified) by:
+ *                 - TAA heuristics/settings for speculative safety
+ *                 - "TSX vs PCR3" select for TSX memory ordering safety
  *  -3 => Implicit tsx=1 (feed-through from spec-ctrl=0)
  *
  * This is arranged such that the bottom bit encodes whether TSX is actually
@@ -50,6 +52,26 @@ void tsx_init(void)
 
         cpu_has_tsx_ctrl = !!(caps & ARCH_CAPS_TSX_CTRL);
 
+        if ( cpu_has_tsx_force_abort )
+        {
+            /*
+             * On an early TSX-enable Skylake part subject to the memory
+             * ordering erratum, with at least the March 2019 microcode.
+             */
+
+            /*
+             * If no explicit tsx= option is provided, pick a default.
+             *
+             * This deliberately overrides the implicit opt_tsx=-3 from
+             * `spec-ctrl=0` because:
+             * - parse_spec_ctrl() ran before any CPU details where know.
+             * - We now know we're running on a CPU not affected by TAA (as
+             *   TSX_FORCE_ABORT is enumerated).
+             */
+            if ( opt_tsx < 0 )
+                opt_tsx = 1;
+        }
+
         /*
          * The TSX features (HLE/RTM) are handled specially.  They both
          * enumerate features but, on certain parts, have mechanisms to be
@@ -75,6 +97,12 @@ void tsx_init(void)
         }
     }
 
+    /*
+     * Note: MSR_TSX_CTRL is enumerated on TSX-enabled MDS_NO and later parts.
+     * MSR_TSX_FORCE_ABORT is enumerated on TSX-enabled pre-MDS_NO Skylake
+     * parts only.  The two features are on a disjoint set of CPUs, and not
+     * offered to guests by hypervisors.
+     */
     if ( cpu_has_tsx_ctrl )
     {
         uint32_t hi, lo;
@@ -90,9 +118,28 @@ void tsx_init(void)
 
         wrmsr(MSR_TSX_CTRL, lo, hi);
     }
+    else if ( cpu_has_tsx_force_abort )
+    {
+        /*
+         * On an early TSX-enable Skylake part subject to the memory ordering
+         * erratum, with at least the March 2019 microcode.
+         */
+        uint32_t hi, lo;
+
+        rdmsr(MSR_TSX_FORCE_ABORT, lo, hi);
+
+        /* Check bottom bit only.  Higher bits are various sentinels. */
+        rtm_disabled = !(opt_tsx & 1);
+
+        lo &= ~TSX_FORCE_ABORT_RTM;
+        if ( rtm_disabled )
+            lo |= TSX_FORCE_ABORT_RTM;
+
+        wrmsr(MSR_TSX_FORCE_ABORT, lo, hi);
+    }
     else if ( opt_tsx >= 0 )
         printk_once(XENLOG_WARNING
-                    "MSR_TSX_CTRL not available - Ignoring tsx= setting\n");
+                    "TSX controls not available - Ignoring tsx= setting\n");
 }
 
 /*
diff --git a/xen/include/asm-x86/vpmu.h b/xen/include/asm-x86/vpmu.h
index 55f85ba00f..4b0a6ba3da 100644
--- a/xen/include/asm-x86/vpmu.h
+++ b/xen/include/asm-x86/vpmu.h
@@ -126,7 +126,6 @@ static inline int vpmu_do_rdmsr(unsigned int msr, uint64_t *msr_content)
 
 extern unsigned int vpmu_mode;
 extern unsigned int vpmu_features;
-extern bool opt_rtm_abort;
 
 /* Context switch */
 static inline void vpmu_switch_from(struct vcpu *prev)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat May 29 09:00:11 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 29 May 2021 09:00:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.134152.249721 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lmup9-0002Rs-Jc; Sat, 29 May 2021 09:00:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 134152.249721; Sat, 29 May 2021 09:00:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lmup9-0002Rk-F1; Sat, 29 May 2021 09:00:03 +0000
Received: by outflank-mailman (input) for mailman id 134152;
 Sat, 29 May 2021 09:00:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lmup8-0002Hq-2T
 for xen-changelog@lists.xenproject.org; Sat, 29 May 2021 09:00:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lmup8-0000YO-0q
 for xen-changelog@lists.xenproject.org; Sat, 29 May 2021 09:00:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lmup7-0001qw-W0
 for xen-changelog@lists.xenproject.org; Sat, 29 May 2021 09:00:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=o/Id9KwpzJ4+5NANLkgpXjbNN//zC330eGgz8aXFkDs=; b=6Pu26WiLFJljk7c/CRvEx17bPh
	K3DK8PIvlqMW0SaZNkeXVROlIBr0qbzhjR72U5RrA6dc5IYJtjSEq8i2QBvUARicM5tcyVBbD2zgn
	KBHuDJH3j+H/f0zIrQmMbgHmyHwhk4GCXOdtX+sKdfuPSbCatet9LYYH7DvC4ggvD+1A=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86: fix build race when generating temporary object files (take 2)
Message-Id: <E1lmup7-0001qw-W0@xenbits.xenproject.org>
Date: Sat, 29 May 2021 09:00:01 +0000

commit 8c90dbb99907f3b471d558775777a84daec7c3f6
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri May 28 09:12:24 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri May 28 09:12:24 2021 +0200

    x86: fix build race when generating temporary object files (take 2)
    
    The original commit wasn't quite sufficient: Emptying DEPS is helpful
    only when nothing will get added to it subsequently. xen/Rules.mk will,
    after including the local Makefile, amend DEPS by dependencies for
    objects living in sub-directories though. For the purpose of suppressing
    dependencies of the makefiles on the .*.d2 files (and thus to avoid
    their re-generation) it is, however, not necessary at all to play with
    DEPS. Instead we can override DEPS_INCLUDE (which generally is a late-
    expansion variable).
    
    Fixes: 761bb575ce97 ("x86: fix build race when generating temporary object files")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile
index 1f5887afc4..2ec883456e 100644
--- a/xen/arch/x86/Makefile
+++ b/xen/arch/x86/Makefile
@@ -313,5 +313,5 @@ clean::
 # Suppress loading of DEPS files for internal, temporary target files.  This
 # then also suppresses re-generation of the respective .*.d2 files.
 ifeq ($(filter-out .xen%.o,$(notdir $(MAKECMDGOALS))),)
-DEPS:=
+DEPS_INCLUDE:=
 endif
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat May 29 09:00:13 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 29 May 2021 09:00:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.134154.249723 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lmupJ-0002wD-Ji; Sat, 29 May 2021 09:00:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 134154.249723; Sat, 29 May 2021 09:00:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lmupJ-0002w5-Ga; Sat, 29 May 2021 09:00:13 +0000
Received: by outflank-mailman (input) for mailman id 134154;
 Sat, 29 May 2021 09:00:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lmupI-0002vy-5L
 for xen-changelog@lists.xenproject.org; Sat, 29 May 2021 09:00:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lmupI-0000YS-4T
 for xen-changelog@lists.xenproject.org; Sat, 29 May 2021 09:00:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lmupI-0001t9-3U
 for xen-changelog@lists.xenproject.org; Sat, 29 May 2021 09:00:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=8K+Agb5cfaE5/ODLTnzQ0V3E0+b79VkXturBbziSgOo=; b=Y/tk5GBFoLXvPKpLofPGReGv73
	wCLM6vMnNY8DSNUUsGIw7K4cvpdk0HHsGwVNHqRpWHLXR5beRYbRVYeDhUdqKkaWKwpbUmMSArwem
	dXPBwvuMfFngqT37dOlTjiUFRK5WRgDaogSwp+3NfnMNk+WzHriBki2qxurlTx2brsgk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] libelf: don't attempt to parse __xen_guest for PVH
Message-Id: <E1lmupI-0001t9-3U@xenbits.xenproject.org>
Date: Sat, 29 May 2021 09:00:12 +0000

commit dec25a2cd1c8089a39900ed978c8e7ab62d2a4d4
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Fri May 28 09:13:32 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri May 28 09:13:32 2021 +0200

    libelf: don't attempt to parse __xen_guest for PVH
    
    The legacy __xen_guest section doesn't support the PHYS32_ENTRY
    elfnote, so it's pointless to attempt to parse the elfnotes from that
    section when called from an hvm container.
    
    Pass an hvm boolean parameter to the elf note parsing routine, so that
    the respective parsing can be suppressed in case libelf is dealing with
    an hvm container.
    
    Suggested-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 tools/fuzz/libelf/libelf-fuzzer.c   | 3 ++-
 tools/libs/guest/xg_dom_elfloader.c | 6 ++++--
 tools/libs/guest/xg_dom_hvmloader.c | 2 +-
 xen/arch/x86/hvm/dom0_build.c       | 2 +-
 xen/arch/x86/pv/dom0_build.c        | 2 +-
 xen/common/libelf/libelf-dominfo.c  | 8 +++-----
 xen/include/xen/libelf.h            | 2 +-
 7 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/tools/fuzz/libelf/libelf-fuzzer.c b/tools/fuzz/libelf/libelf-fuzzer.c
index 1ba8571711..84fb84720f 100644
--- a/tools/fuzz/libelf/libelf-fuzzer.c
+++ b/tools/fuzz/libelf/libelf-fuzzer.c
@@ -17,7 +17,8 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
         return -1;
 
     elf_parse_binary(elf);
-    elf_xen_parse(elf, &parms);
+    elf_xen_parse(elf, &parms, false);
+    elf_xen_parse(elf, &parms, true);
 
     return 0;
 }
diff --git a/tools/libs/guest/xg_dom_elfloader.c b/tools/libs/guest/xg_dom_elfloader.c
index 0d6247db5d..f17930d98b 100644
--- a/tools/libs/guest/xg_dom_elfloader.c
+++ b/tools/libs/guest/xg_dom_elfloader.c
@@ -135,7 +135,8 @@ static elf_negerrnoval xc_dom_probe_elf_kernel(struct xc_dom_image *dom)
      * or else we might be trying to load a plain ELF.
      */
     elf_parse_binary(&elf);
-    rc = elf_xen_parse(&elf, dom->parms);
+    rc = elf_xen_parse(&elf, dom->parms,
+                       dom->container_type == XC_DOM_HVM_CONTAINER);
     if ( rc != 0 )
         return rc;
 
@@ -166,7 +167,8 @@ static elf_negerrnoval xc_dom_parse_elf_kernel(struct xc_dom_image *dom)
 
     /* parse binary and get xen meta info */
     elf_parse_binary(elf);
-    if ( elf_xen_parse(elf, dom->parms) != 0 )
+    if ( elf_xen_parse(elf, dom->parms,
+                       dom->container_type == XC_DOM_HVM_CONTAINER) != 0 )
     {
         rc = -EINVAL;
         goto out;
diff --git a/tools/libs/guest/xg_dom_hvmloader.c b/tools/libs/guest/xg_dom_hvmloader.c
index 4e6f30858a..ae50d98011 100644
--- a/tools/libs/guest/xg_dom_hvmloader.c
+++ b/tools/libs/guest/xg_dom_hvmloader.c
@@ -73,7 +73,7 @@ static elf_negerrnoval xc_dom_probe_hvm_kernel(struct xc_dom_image *dom)
      * else we might be trying to load a PV kernel.
      */
     elf_parse_binary(&elf);
-    rc = elf_xen_parse(&elf, dom->parms);
+    rc = elf_xen_parse(&elf, dom->parms, true);
     if ( rc == 0 )
         return -EINVAL;
 
diff --git a/xen/arch/x86/hvm/dom0_build.c b/xen/arch/x86/hvm/dom0_build.c
index 878dc1d808..c24b9efdb0 100644
--- a/xen/arch/x86/hvm/dom0_build.c
+++ b/xen/arch/x86/hvm/dom0_build.c
@@ -561,7 +561,7 @@ static int __init pvh_load_kernel(struct domain *d, const module_t *image,
     elf_set_verbose(&elf);
 #endif
     elf_parse_binary(&elf);
-    if ( (rc = elf_xen_parse(&elf, &parms)) != 0 )
+    if ( (rc = elf_xen_parse(&elf, &parms, true)) != 0 )
     {
         printk("Unable to parse kernel for ELFNOTES\n");
         return rc;
diff --git a/xen/arch/x86/pv/dom0_build.c b/xen/arch/x86/pv/dom0_build.c
index e0801a9e6d..af47615b22 100644
--- a/xen/arch/x86/pv/dom0_build.c
+++ b/xen/arch/x86/pv/dom0_build.c
@@ -353,7 +353,7 @@ int __init dom0_construct_pv(struct domain *d,
         elf_set_verbose(&elf);
 
     elf_parse_binary(&elf);
-    if ( (rc = elf_xen_parse(&elf, &parms)) != 0 )
+    if ( (rc = elf_xen_parse(&elf, &parms, false)) != 0 )
         goto out;
 
     /* compatibility check */
diff --git a/xen/common/libelf/libelf-dominfo.c b/xen/common/libelf/libelf-dominfo.c
index 69c94b6f3b..bd295a9b7e 100644
--- a/xen/common/libelf/libelf-dominfo.c
+++ b/xen/common/libelf/libelf-dominfo.c
@@ -499,7 +499,7 @@ static elf_errorstatus elf_xen_addr_calc_check(struct elf_binary *elf,
 /* glue it all together ...                                                 */
 
 elf_errorstatus elf_xen_parse(struct elf_binary *elf,
-                  struct elf_dom_parms *parms)
+                  struct elf_dom_parms *parms, bool hvm)
 {
     ELF_HANDLE_DECL(elf_shdr) shdr;
     ELF_HANDLE_DECL(elf_phdr) phdr;
@@ -577,10 +577,8 @@ elf_errorstatus elf_xen_parse(struct elf_binary *elf,
 
     }
 
-    /*
-     * Finally fall back to the __xen_guest section.
-     */
-    if ( xen_elfnotes == 0 )
+    /* Finally fall back to the __xen_guest section for PV guests only. */
+    if ( xen_elfnotes == 0 && !hvm )
     {
         shdr = elf_shdr_by_name(elf, "__xen_guest");
         if ( ELF_HANDLE_VALID(shdr) )
diff --git a/xen/include/xen/libelf.h b/xen/include/xen/libelf.h
index b73998150f..be47b0cc36 100644
--- a/xen/include/xen/libelf.h
+++ b/xen/include/xen/libelf.h
@@ -454,7 +454,7 @@ int elf_xen_parse_note(struct elf_binary *elf,
 int elf_xen_parse_guest_info(struct elf_binary *elf,
                              struct elf_dom_parms *parms);
 int elf_xen_parse(struct elf_binary *elf,
-                  struct elf_dom_parms *parms);
+                  struct elf_dom_parms *parms, bool hvm);
 
 static inline void *elf_memcpy_unchecked(void *dest, const void *src, size_t n)
     { return memcpy(dest, src, n); }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat May 29 09:00:23 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 29 May 2021 09:00:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.134156.249727 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lmupT-0002zs-Lc; Sat, 29 May 2021 09:00:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 134156.249727; Sat, 29 May 2021 09:00:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lmupT-0002zj-I8; Sat, 29 May 2021 09:00:23 +0000
Received: by outflank-mailman (input) for mailman id 134156;
 Sat, 29 May 2021 09:00:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lmupS-0002zM-8H
 for xen-changelog@lists.xenproject.org; Sat, 29 May 2021 09:00:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lmupS-0000Yk-7V
 for xen-changelog@lists.xenproject.org; Sat, 29 May 2021 09:00:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lmupS-0001tt-6e
 for xen-changelog@lists.xenproject.org; Sat, 29 May 2021 09:00:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=U/FrZBFQUriKlUXMS8VD3CNGH0IiItrwS13qAbwKV7Y=; b=O1q0Gq/4WyZk0z6r7QJyL5IojO
	fzs1t0JtrAMpsQVrrxGvICOprlDM7NyOR5ge7bwslvIDcmX0tIJXzPHYJ1QuGnIAOfV04HMC5VQv+
	SlefCt/yFs4e/0DmD2asY/pq7E0Hkt/t1SIQkEQ/shEq3emP5ae2Iy3msRlYjpBJunGQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] libelf: improve PVH elfnote parsing
Message-Id: <E1lmupS-0001tt-6e@xenbits.xenproject.org>
Date: Sat, 29 May 2021 09:00:22 +0000

commit 632cbaf1243e4b867caf321cfef81517f5cc27ad
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Fri May 28 09:14:44 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri May 28 09:14:44 2021 +0200

    libelf: improve PVH elfnote parsing
    
    Pass an hvm boolean parameter to the elf note checking routines, so that
    better checking can be done in case libelf is dealing with an hvm
    container.
    
    elf_xen_note_check shouldn't return early unless PHYS32_ENTRY is set
    and the container is of type HVM, or else the loader and version
    checks would be avoided for kernels intended to be booted as PV but
    that also have PHYS32_ENTRY set.
    
    Adjust elf_xen_addr_calc_check so that the virtual addresses are
    actually physical ones (by setting virt_base and elf_paddr_offset to
    zero) when the container is of type HVM, as that container is always
    started with paging disabled.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/common/libelf/libelf-dominfo.c | 41 ++++++++++++++++++++++++--------------
 1 file changed, 26 insertions(+), 15 deletions(-)

diff --git a/xen/common/libelf/libelf-dominfo.c b/xen/common/libelf/libelf-dominfo.c
index bd295a9b7e..24d1371dd7 100644
--- a/xen/common/libelf/libelf-dominfo.c
+++ b/xen/common/libelf/libelf-dominfo.c
@@ -360,7 +360,7 @@ elf_errorstatus elf_xen_parse_guest_info(struct elf_binary *elf,
 /* sanity checks                                                            */
 
 static elf_errorstatus elf_xen_note_check(struct elf_binary *elf,
-                              struct elf_dom_parms *parms)
+                              struct elf_dom_parms *parms, bool hvm)
 {
     if ( (ELF_PTRVAL_INVALID(parms->elf_note_start)) &&
          (ELF_PTRVAL_INVALID(parms->guest_info)) )
@@ -382,7 +382,7 @@ static elf_errorstatus elf_xen_note_check(struct elf_binary *elf,
     }
 
     /* PVH only requires one ELF note to be set */
-    if ( parms->phys_entry != UNSET_ADDR32 )
+    if ( parms->phys_entry != UNSET_ADDR32 && hvm )
     {
         elf_msg(elf, "ELF: Found PVH image\n");
         return 0;
@@ -414,7 +414,7 @@ static elf_errorstatus elf_xen_note_check(struct elf_binary *elf,
 }
 
 static elf_errorstatus elf_xen_addr_calc_check(struct elf_binary *elf,
-                                   struct elf_dom_parms *parms)
+                                   struct elf_dom_parms *parms, bool hvm)
 {
     uint64_t virt_offset;
 
@@ -425,12 +425,15 @@ static elf_errorstatus elf_xen_addr_calc_check(struct elf_binary *elf,
         return -1;
     }
 
-    /* Initial guess for virt_base is 0 if it is not explicitly defined. */
-    if ( parms->virt_base == UNSET_ADDR )
+    /*
+     * Initial guess for virt_base is 0 if it is not explicitly defined in the
+     * PV case. For PVH virt_base is forced to 0 because paging is disabled.
+     */
+    if ( parms->virt_base == UNSET_ADDR || hvm )
     {
         parms->virt_base = 0;
-        elf_msg(elf, "ELF: VIRT_BASE unset, using %#" PRIx64 "\n",
-                parms->virt_base);
+        if ( !hvm )
+            elf_msg(elf, "ELF: VIRT_BASE unset, using 0\n");
     }
 
     /*
@@ -441,23 +444,31 @@ static elf_errorstatus elf_xen_addr_calc_check(struct elf_binary *elf,
      *
      * If we are using the modern ELF notes interface then the default
      * is 0.
+     *
+     * For PVH this is forced to 0, as it's already a legacy option for PV.
      */
-    if ( parms->elf_paddr_offset == UNSET_ADDR )
+    if ( parms->elf_paddr_offset == UNSET_ADDR || hvm )
     {
-        if ( parms->elf_note_start )
+        if ( parms->elf_note_start || hvm )
             parms->elf_paddr_offset = 0;
         else
             parms->elf_paddr_offset = parms->virt_base;
-        elf_msg(elf, "ELF_PADDR_OFFSET unset, using %#" PRIx64 "\n",
-                parms->elf_paddr_offset);
+        if ( !hvm )
+            elf_msg(elf, "ELF_PADDR_OFFSET unset, using %#" PRIx64 "\n",
+                    parms->elf_paddr_offset);
     }
 
     virt_offset = parms->virt_base - parms->elf_paddr_offset;
     parms->virt_kstart = elf->pstart + virt_offset;
     parms->virt_kend   = elf->pend   + virt_offset;
 
-    if ( parms->virt_entry == UNSET_ADDR )
-        parms->virt_entry = elf_uval(elf, elf->ehdr, e_entry);
+    if ( parms->virt_entry == UNSET_ADDR || hvm )
+    {
+        if ( parms->phys_entry != UNSET_ADDR32 && hvm )
+            parms->virt_entry = parms->phys_entry;
+        else
+            parms->virt_entry = elf_uval(elf, elf->ehdr, e_entry);
+    }
 
     if ( parms->bsd_symtab )
     {
@@ -592,9 +603,9 @@ elf_errorstatus elf_xen_parse(struct elf_binary *elf,
         }
     }
 
-    if ( elf_xen_note_check(elf, parms) != 0 )
+    if ( elf_xen_note_check(elf, parms, hvm) != 0 )
         return -1;
-    if ( elf_xen_addr_calc_check(elf, parms) != 0 )
+    if ( elf_xen_addr_calc_check(elf, parms, hvm) != 0 )
         return -1;
     return 0;
 }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat May 29 09:00:33 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 29 May 2021 09:00:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.134157.249731 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lmupd-00033W-NK; Sat, 29 May 2021 09:00:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 134157.249731; Sat, 29 May 2021 09:00:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lmupd-00033O-Jq; Sat, 29 May 2021 09:00:33 +0000
Received: by outflank-mailman (input) for mailman id 134157;
 Sat, 29 May 2021 09:00:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lmupc-000335-BZ
 for xen-changelog@lists.xenproject.org; Sat, 29 May 2021 09:00:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lmupc-0000Yv-Ai
 for xen-changelog@lists.xenproject.org; Sat, 29 May 2021 09:00:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lmupc-0001v4-9f
 for xen-changelog@lists.xenproject.org; Sat, 29 May 2021 09:00:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=g8Mjv9XqkWqri6RPr9vjhHNhAW9t0vzvsu9lg8lWHGA=; b=bTk1hx63gurZSw6MyJDkNTgfzJ
	xUiB1uX6SZRXCBw9Iz6tBn1s9KRC5LPBonv6fXOWnRdUvMjFRYt8Jk/C1O+hS367k6syah+yGdH1q
	3oW1iUEInntJwVA2eSVYpPucG6N8r2hHVW2bZCkXx8a/B+MTlSYU8NiXythl50ivrzqc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] common: guard iommu symbols with CONFIG_HAS_PASSTHROUGH
Message-Id: <E1lmupc-0001v4-9f@xenbits.xenproject.org>
Date: Sat, 29 May 2021 09:00:32 +0000

commit 683d899e4bffca35c5b192ea0662362b0270a695
Author:     Connor Davis <connojdavis@gmail.com>
AuthorDate: Fri May 28 09:42:25 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri May 28 09:42:25 2021 +0200

    common: guard iommu symbols with CONFIG_HAS_PASSTHROUGH
    
    The variables iommu_enabled and iommu_dont_flush_iotlb are defined in
    drivers/passthrough/iommu.c and are referenced in common code, which
    causes the link to fail when !CONFIG_HAS_PASSTHROUGH.
    
    Guard references to these variables in common code so that xen
    builds when !CONFIG_HAS_PASSTHROUGH.
    
    Signed-off-by: Connor Davis <connojdavis@gmail.com>
    [jb: further massage xen/iommu.h adjustment]
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/common/memory.c     | 10 ++++++++++
 xen/include/xen/iommu.h |  4 ++++
 2 files changed, 14 insertions(+)

diff --git a/xen/common/memory.c b/xen/common/memory.c
index b5c70c4b85..72a6b70cb5 100644
--- a/xen/common/memory.c
+++ b/xen/common/memory.c
@@ -294,7 +294,9 @@ int guest_remove_page(struct domain *d, unsigned long gmfn)
     p2m_type_t p2mt;
 #endif
     mfn_t mfn;
+#ifdef CONFIG_HAS_PASSTHROUGH
     bool *dont_flush_p, dont_flush;
+#endif
     int rc;
 
 #ifdef CONFIG_X86
@@ -385,13 +387,17 @@ int guest_remove_page(struct domain *d, unsigned long gmfn)
      * Since we're likely to free the page below, we need to suspend
      * xenmem_add_to_physmap()'s suppressing of IOMMU TLB flushes.
      */
+#ifdef CONFIG_HAS_PASSTHROUGH
     dont_flush_p = &this_cpu(iommu_dont_flush_iotlb);
     dont_flush = *dont_flush_p;
     *dont_flush_p = false;
+#endif
 
     rc = guest_physmap_remove_page(d, _gfn(gmfn), mfn, 0);
 
+#ifdef CONFIG_HAS_PASSTHROUGH
     *dont_flush_p = dont_flush;
+#endif
 
     /*
      * With the lack of an IOMMU on some platforms, domains with DMA-capable
@@ -839,11 +845,13 @@ int xenmem_add_to_physmap(struct domain *d, struct xen_add_to_physmap *xatp,
     xatp->gpfn += start;
     xatp->size -= start;
 
+#ifdef CONFIG_HAS_PASSTHROUGH
     if ( is_iommu_enabled(d) )
     {
        this_cpu(iommu_dont_flush_iotlb) = 1;
        extra.ppage = &pages[0];
     }
+#endif
 
     while ( xatp->size > done )
     {
@@ -868,6 +876,7 @@ int xenmem_add_to_physmap(struct domain *d, struct xen_add_to_physmap *xatp,
         }
     }
 
+#ifdef CONFIG_HAS_PASSTHROUGH
     if ( is_iommu_enabled(d) )
     {
         int ret;
@@ -894,6 +903,7 @@ int xenmem_add_to_physmap(struct domain *d, struct xen_add_to_physmap *xatp,
         if ( unlikely(ret) && rc >= 0 )
             rc = ret;
     }
+#endif
 
     return rc;
 }
diff --git a/xen/include/xen/iommu.h b/xen/include/xen/iommu.h
index 460755df29..03420cbea3 100644
--- a/xen/include/xen/iommu.h
+++ b/xen/include/xen/iommu.h
@@ -51,8 +51,12 @@ static inline bool_t dfn_eq(dfn_t x, dfn_t y)
     return dfn_x(x) == dfn_x(y);
 }
 
+#ifdef CONFIG_HAS_PASSTHROUGH
 extern bool_t iommu_enable, iommu_enabled;
 extern bool force_iommu, iommu_quarantine, iommu_verbose;
+#else
+#define iommu_enabled false
+#endif
 
 #ifdef CONFIG_X86
 extern enum __packed iommu_intremap {
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon May 31 10:55:15 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 31 May 2021 10:55:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.134515.250221 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lnfZa-0003AX-KC; Mon, 31 May 2021 10:55:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 134515.250221; Mon, 31 May 2021 10:55:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lnfZa-0003AP-HA; Mon, 31 May 2021 10:55:06 +0000
Received: by outflank-mailman (input) for mailman id 134515;
 Mon, 31 May 2021 10:55:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lnfZZ-0003AJ-4M
 for xen-changelog@lists.xenproject.org; Mon, 31 May 2021 10:55:05 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lnfZZ-0007nw-2b
 for xen-changelog@lists.xenproject.org; Mon, 31 May 2021 10:55:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lnfZZ-0003WT-1N
 for xen-changelog@lists.xenproject.org; Mon, 31 May 2021 10:55:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=9BdWHkf+MLYJBmN4Y8r26gOzLkjRef77h01fnQOf5qk=; b=zVVQ30VkCPodZzo+XCr9dwALx/
	Z/BvEBEYkrvkO0Y/Lrhtof+Kh9VmSoX9RnqZHB5mbaIrnDwLAgdlvJnVGe5M/TnYT4uZGQgNDeAwE
	IKwJ7xdSd6rjNF0quux3DgAIvZDlRskSlOw2IJ2m+n0L3XcvB+kwp7XTUbyLxGE6wV2I=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/tboot: include all valid frame table entries in S3 integrity check
Message-Id: <E1lnfZZ-0003WT-1N@xenbits.xenproject.org>
Date: Mon, 31 May 2021 10:55:05 +0000

commit 8701f68d26afc641527c775d2e56a8709f535ffd
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon May 31 12:45:51 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon May 31 12:45:51 2021 +0200

    x86/tboot: include all valid frame table entries in S3 integrity check
    
    The difference of two pdx_to_page() return values is a number of pages,
    not the number of bytes covered by the corresponding frame table entries.
    
    Fixes: 3cb68d2b59ab ("tboot: fix S3 issue for Intel Trusted Execution Technology.")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Lukasz Hawrylko <lukasz.hawrylko@linux.intel.com>
---
 xen/arch/x86/tboot.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/tboot.c b/xen/arch/x86/tboot.c
index aadcce591f..f394bd33b1 100644
--- a/xen/arch/x86/tboot.c
+++ b/xen/arch/x86/tboot.c
@@ -323,12 +323,12 @@ static void tboot_gen_frametable_integrity(const uint8_t key[TB_KEY_SIZE],
         if ( nidx >= max_idx )
             break;
         vmac_update((uint8_t *)pdx_to_page(sidx * PDX_GROUP_COUNT),
-                       pdx_to_page(eidx * PDX_GROUP_COUNT)
-                       - pdx_to_page(sidx * PDX_GROUP_COUNT), &ctx);
+                    (eidx - sidx) * PDX_GROUP_COUNT * sizeof(*frame_table),
+                    &ctx);
     }
     vmac_update((uint8_t *)pdx_to_page(sidx * PDX_GROUP_COUNT),
-                   pdx_to_page(max_pdx - 1) + 1
-                   - pdx_to_page(sidx * PDX_GROUP_COUNT), &ctx);
+                (max_pdx - sidx * PDX_GROUP_COUNT) * sizeof(*frame_table),
+                &ctx);
 
     *mac = vmac(NULL, 0, nonce, NULL, &ctx);
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon May 31 10:55:16 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 31 May 2021 10:55:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.134516.250225 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lnfZk-0003CC-Li; Mon, 31 May 2021 10:55:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 134516.250225; Mon, 31 May 2021 10:55:16 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lnfZk-0003C4-Ik; Mon, 31 May 2021 10:55:16 +0000
Received: by outflank-mailman (input) for mailman id 134516;
 Mon, 31 May 2021 10:55:15 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lnfZj-0003Bi-6k
 for xen-changelog@lists.xenproject.org; Mon, 31 May 2021 10:55:15 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lnfZj-0007o0-5t
 for xen-changelog@lists.xenproject.org; Mon, 31 May 2021 10:55:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lnfZj-0003XF-4v
 for xen-changelog@lists.xenproject.org; Mon, 31 May 2021 10:55:15 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=s2dTt5gr20qle4dDSL7MIV7SCmee3Mb1D0tGDU6QqcE=; b=iO5dKjB2p4ZylUrAsm1UZJv5KQ
	K2v7KaQnznYyo6liMqrAlv41RSmtwz2fXl+9RmAKDQn/l9AqQFkZCIBxCInfJM4OIiE0N4JXKHYed
	JpdAXTUxRgliHb6vI0i56MA9f2G1j7jB3l8NkgH+pAAbNWrz9g/+0lGDmz0SJlxdZyek=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/tboot: adjust UUID check
Message-Id: <E1lnfZj-0003XF-4v@xenbits.xenproject.org>
Date: Mon, 31 May 2021 10:55:15 +0000

commit e95c243f67a95bca8b4be62b4e024c64ab082e56
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon May 31 12:46:48 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon May 31 12:46:48 2021 +0200

    x86/tboot: adjust UUID check
    
    Replace a bogus cast, move the static variable into the only function
    using it, and add __initconst. While there, also remove a pointless NULL
    check.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Lukasz Hawrylko <lukasz.hawrylko@linux.intel.com>
---
 xen/arch/x86/tboot.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/xen/arch/x86/tboot.c b/xen/arch/x86/tboot.c
index f394bd33b1..529367ed81 100644
--- a/xen/arch/x86/tboot.c
+++ b/xen/arch/x86/tboot.c
@@ -27,8 +27,6 @@ static vmac_t domain_mac;     /* MAC for all domains during S3 */
 static vmac_t xenheap_mac;    /* MAC for xen heap during S3 */
 static vmac_t frametable_mac; /* MAC for frame table during S3 */
 
-static const uuid_t tboot_shared_uuid = TBOOT_SHARED_UUID;
-
 /* used by tboot_protect_mem_regions() and/or tboot_parse_dmar_table() */
 static uint64_t __initdata txt_heap_base, __initdata txt_heap_size;
 static uint64_t __initdata sinit_base, __initdata sinit_size;
@@ -93,6 +91,7 @@ static void __init tboot_copy_memory(unsigned char *va, uint32_t size,
 void __init tboot_probe(void)
 {
     tboot_shared_t *tboot_shared;
+    static const uuid_t __initconst tboot_shared_uuid = TBOOT_SHARED_UUID;
 
     /* Look for valid page-aligned address for shared page. */
     if ( !opt_tboot_pa || (opt_tboot_pa & ~PAGE_MASK) )
@@ -101,9 +100,7 @@ void __init tboot_probe(void)
     /* Map and check for tboot UUID. */
     set_fixmap(FIX_TBOOT_SHARED_BASE, opt_tboot_pa);
     tboot_shared = fix_to_virt(FIX_TBOOT_SHARED_BASE);
-    if ( tboot_shared == NULL )
-        return;
-    if ( memcmp(&tboot_shared_uuid, (uuid_t *)tboot_shared, sizeof(uuid_t)) )
+    if ( memcmp(&tboot_shared_uuid, &tboot_shared->uuid, sizeof(uuid_t)) )
         return;
 
     /* new tboot_shared (w/ GAS support, integrity, etc.) is not backwards
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon May 31 10:55:26 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 31 May 2021 10:55:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.134517.250231 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lnfZu-0003FE-OK; Mon, 31 May 2021 10:55:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 134517.250231; Mon, 31 May 2021 10:55:26 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lnfZu-0003F4-KK; Mon, 31 May 2021 10:55:26 +0000
Received: by outflank-mailman (input) for mailman id 134517;
 Mon, 31 May 2021 10:55:25 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lnfZt-0003Eg-9o
 for xen-changelog@lists.xenproject.org; Mon, 31 May 2021 10:55:25 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lnfZt-0007oI-8y
 for xen-changelog@lists.xenproject.org; Mon, 31 May 2021 10:55:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lnfZt-0003Y9-7w
 for xen-changelog@lists.xenproject.org; Mon, 31 May 2021 10:55:25 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=AKJ3RuDymXd2WhcTXOtH7uzaSrv6+0KlzkjIn3S5DFk=; b=Hg4UcKpeKC4VRynA6HRFMXKa+8
	NgEbh9Fsm1faVdUsMTDVvJAwTJS4RpNsuNP7PujyLqx7uUX4pxx8maHiFIXI6OnNsOd6gHdLfjdI0
	JSwiUEqBxUf3yPIVUmqQYDJB+WtEtEI+fZ9SmlMbL5G49nu7D36P/TVCeO09Jdzbwk24=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/mtrr: remove stale function prototype
Message-Id: <E1lnfZt-0003Y9-7w@xenbits.xenproject.org>
Date: Mon, 31 May 2021 10:55:25 +0000

commit 57f68dfd2d111a2ad381df740543c901b41f2299
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Mon May 31 12:47:12 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon May 31 12:47:12 2021 +0200

    x86/mtrr: remove stale function prototype
    
    Fixes: 1c84d04673 ('VMX: remove the problematic set_uc_mode logic')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/include/asm-x86/mtrr.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/xen/include/asm-x86/mtrr.h b/xen/include/asm-x86/mtrr.h
index 4be704cb6a..24e5de5c22 100644
--- a/xen/include/asm-x86/mtrr.h
+++ b/xen/include/asm-x86/mtrr.h
@@ -78,8 +78,6 @@ extern u32 get_pat_flags(struct vcpu *v, u32 gl1e_flags, paddr_t gpaddr,
 extern int epte_get_entry_emt(struct domain *, unsigned long gfn, mfn_t mfn,
                               unsigned int order, uint8_t *ipat,
                               bool_t direct_mmio);
-extern void ept_change_entry_emt_with_range(
-    struct domain *d, unsigned long start_gfn, unsigned long end_gfn);
 extern unsigned char pat_type_2_pte_flags(unsigned char pat_type);
 extern int hold_mtrr_updates_on_aps;
 extern void mtrr_aps_sync_begin(void);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


