From patchwork Thu Oct 31 15:09:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 178201 Delivered-To: patch@linaro.org Received: by 2002:a92:409a:0:0:0:0:0 with SMTP id d26csp2980517ill; Thu, 31 Oct 2019 08:11:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqwLNicv+o29IZ8zzQDkuUgECRggDQPMubNJ5gSIM9o99eoLC+JLeuQ2XNbeQGPG55iIyIaU X-Received: by 2002:a6b:f40f:: with SMTP id i15mr5396994iog.54.1572534693125; Thu, 31 Oct 2019 08:11:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572534693; cv=none; d=google.com; s=arc-20160816; b=yoGXTHAQtSbgzerLqTD0lArGh8LMK/fkksVA+D9HJvDhzazjO2yCCDBZP+YKC4iNTU Ea9WYUwx4oolN3vKAEAu1l0i51GR5oYo25tGESePN/WpDakQYM8NGPGMiHAqivB+E9iz OSGJRZezGpy7wI+eQDRy1UIbcqqnvlIEwREU9DAI3hpfvARJSUR/PTnw5Ll8+SIzjxn2 PkqMTsLsaQc95lQWyNngGvdIzvDT0ewdPzVx5Q0P5ZNFX/lEdFRXIuGZSsIlbcpKLQi9 oZkuXR1xZAOZDUpUPNyFbNeonb1PNFzb4lYiTYd8EmRn+vpR+LtQ2VqWTHJJWDcSw/rj zLpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:references:in-reply-to:message-id:date:to:from; bh=2UyzX+76bJhBsQY0fJNPZtAbE0R8LAePnLKpglJFgXY=; b=q5fEuME+9XcBGzPd2W9GR7UU7TaW81V4Iz5W9HTCa/BG7q3j8nFt9W4kcNNjDstgwY 1P925pMh9F1Fko62GNemoDYPKOOgvSewKVV9WnPmTinbowT8XfrmNiEMtkrQGNicVClQ DbdXUXz/nDzhMjmWl57HhyisP8/eEkp0ItE9IcSN9t/4zqcUW4h2Mas3desgjeGw4Aju soSyj7XCNWF2Ph594/LrlckyH+ruHpL0DAFMbDTGcqbwLeyEwoKERDUbB/ihR6a2H4I/ 17sdXBZ3T+sWoiALnzlEa1VFvOGJPrtzkMW30YPUNCO3WKs0iTxb13qQtiI05GQ5tHPb e6HQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id y8si9612055jan.59.2019.10.31.08.11.32 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 31 Oct 2019 08:11:33 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iQC5S-0007NR-KA; Thu, 31 Oct 2019 15:10:10 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iQC5R-0007J5-Cf for xen-devel@lists.xenproject.org; Thu, 31 Oct 2019 15:10:09 +0000 X-Inumbo-ID: 7e826990-fbf0-11e9-beca-bc764e2007e4 Received: from foss.arm.com (unknown [217.140.110.172]) by us1-rack-iad1.inumbo.com (Halon) with ESMTP id 7e826990-fbf0-11e9-beca-bc764e2007e4; Thu, 31 Oct 2019 15:09:54 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 5CA497FA; Thu, 31 Oct 2019 08:09:54 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (unknown [10.1.196.50]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 6E66A3F71E; Thu, 31 Oct 2019 08:09:53 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Thu, 31 Oct 2019 15:09:20 +0000 Message-Id: <20191031150922.22938-18-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20191031150922.22938-1-julien.grall@arm.com> References: <20191031150922.22938-1-julien.grall@arm.com> Subject: [Xen-devel] [PATCH for-4.13 v4 17/19] xen/arm: asm: Replace use of ALTERNATIVE with alternative_if X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: jgross@suse.com, Volodymyr Babchuk , Julien Grall , Stefano Stabellini , Julien Grall MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" Using alternative_if makes the code a bit more streamlined. Take the opportunity to use the new auto-nop infrastructure to avoid counting the number of nop in the else part for arch/arm/arm64/entry.S Signed-off-by: Julien Grall Reviewed-by: Stefano Stabellini --- This is pretty much a matter of taste, but at least for arm64 this allows us to use the auto-nop infrastructure. So the arm32 is more to keep inline with arm64. Changes in v4: - Add Stefano's reviewed-by Changes in v3: - Fix build on Arm32 Changes in v2: - Correctly use alternative_if{, _not} --- xen/arch/arm/arm32/entry.S | 7 ++++--- xen/arch/arm/arm64/entry.S | 8 +++++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/xen/arch/arm/arm32/entry.S b/xen/arch/arm/arm32/entry.S index 0a9c248ee2..34156c4404 100644 --- a/xen/arch/arm/arm32/entry.S +++ b/xen/arch/arm/arm32/entry.S @@ -59,9 +59,10 @@ arch_enter_hypervisor_from_guest_preirq: * If the SKIP_SYNCHRONIZE_SERROR_ENTRY_EXIT has been set in the cpu * feature, the checking of pending SErrors will be skipped. */ - ALTERNATIVE("nop", - "b skip_check", - SKIP_SYNCHRONIZE_SERROR_ENTRY_EXIT) + alternative_if SKIP_SYNCHRONIZE_SERROR_ENTRY_EXIT + b skip_check + alternative_else_nop_endif + /* * Start to check pending virtual abort in the gap of Guest -> HYP * world switch. diff --git a/xen/arch/arm/arm64/entry.S b/xen/arch/arm/arm64/entry.S index d4fb5fdc1c..a8ba7ab961 100644 --- a/xen/arch/arm/arm64/entry.S +++ b/xen/arch/arm/arm64/entry.S @@ -188,9 +188,11 @@ * is not set. If a vSError took place, the initial exception will be * skipped. Exit ASAP */ - ALTERNATIVE("bl check_pending_vserror; cbnz x0, 1f", - "nop; nop", - SKIP_SYNCHRONIZE_SERROR_ENTRY_EXIT) + alternative_if_not SKIP_SYNCHRONIZE_SERROR_ENTRY_EXIT + bl check_pending_vserror + cbnz x0, 1f + alternative_else_nop_endif + bl enter_hypervisor_from_guest_preirq msr daifclr, \iflags bl enter_hypervisor_from_guest