From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C2C96C433EF for ; Fri, 1 Jul 2022 10:51:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Message-ID:References:In-Reply-To:Subject:Cc:To:From :Date:MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Zho5sdqNaSwTRE3yBwwMUGZskMxCSnnnEMxnvxbJJUQ=; b=K2jO6HVpTVSKHhWLl6wtdfp44O nt4Y+XKa9sNzox0OnfyChDWIwdGc4RFU7tmvLkAQVgSy8ZNHGI0mKBuhFWV13jgSXyCN9CQetF0St TEzAn2pdeKlXbi/cYwOKA3X7s09DwcM3a2uMEvZ4/JdxSJAPRE7Pg1G0Rbzu/T1XdIrGlfkM3+R2a y0MgUFMmdL45BuS4EpMsnPgurSDWT0BOLYFcGKmD/ZwbY7nUuirdaTPYmWsWEA3NV6QuowyeuREbo +shWa4t/G5jZrxy02IEW8+E3OaUxTOlNzQRcv5xVkvvFFnNyLktpOEr6eX5I2S1OPwp3wtlte1wg0 kuXyIjiQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o7EE0-004BQi-BI; Fri, 01 Jul 2022 10:50:12 +0000 Received: from ams.source.kernel.org ([2604:1380:4601:e00::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o7EDv-004BOS-Hq for linux-arm-kernel@lists.infradead.org; Fri, 01 Jul 2022 10:50:09 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id BCC58B82F45; Fri, 1 Jul 2022 10:50:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 47832C3411E; Fri, 1 Jul 2022 10:50:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1656672604; bh=KL3HCbfmIFwpgQxHgKNqdfe68KZEBjGoiTLhKkW04Vc=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=BZ8+LMQYkO8E3V0b8x4/wGg6JBNFWqJgwC4FRyMHck0/WTp19N4v4FQPnclu+j6uR tto47Kdud5bf028XT5T9xTI4e8nCc0FwS2yNCid9JchnCytU5A2DqvMnnV1o6H8AXA ZEZLW9NYPVGbKq/79ooZL4bkpTAoYHmbp3C3xXaCYGp1pSzxy79HHc46bmn4yxF8zr VCl0gB3p81ePFR2Vheu2BXxncQd+PVrwLIO3tivUDNPMDfYiYf0vSgoXhJohV70HtW UbCx/X16K93C/U1017ms10b96VSYr9qHLl1IymA5e1ONQD/z+1HQ16HBR6cxEH+Plz B4+WTj3FrWRmw== Received: from disco-boy.misterjones.org ([51.254.78.96] helo=www.loen.fr) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1o7EDp-004Z3B-EI; Fri, 01 Jul 2022 11:50:01 +0100 MIME-Version: 1.0 Date: Fri, 01 Jul 2022 11:50:01 +0100 From: Marc Zyngier To: Schspa Shi Cc: james.morse@arm.com, alexandru.elisei@arm.com, suzuki.poulose@arm.com, catalin.marinas@arm.com, will@kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org Subject: Re: [PATCH] KVM: arm64: Fix 64 bit mmio handle In-Reply-To: References: <20220630161220.53449-1-schspa@gmail.com> <87mtdu15ok.wl-maz@kernel.org> User-Agent: Roundcube Webmail/1.4.13 Message-ID: X-Sender: maz@kernel.org X-SA-Exim-Connect-IP: 51.254.78.96 X-SA-Exim-Rcpt-To: schspa@gmail.com, james.morse@arm.com, alexandru.elisei@arm.com, suzuki.poulose@arm.com, catalin.marinas@arm.com, will@kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220701_035007_939986_C7433141 X-CRM114-Status: GOOD ( 20.22 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 2022-06-30 17:50, Schspa Shi wrote: > Marc Zyngier writes: > >> On Thu, 30 Jun 2022 17:12:20 +0100, >> Schspa Shi wrote: >>> >>> If the len is 8 bytes, we can't get the correct sign extend for >>> be system. >> >> I'm afraid you'll have to give me a bit more details. >> >>> >>> Fix the mask type len and the comparison of length. >>> >>> Signed-off-by: Schspa Shi >>> --- >>> arch/arm64/kvm/mmio.c | 4 ++-- >>> 1 file changed, 2 insertions(+), 2 deletions(-) >>> >>> diff --git a/arch/arm64/kvm/mmio.c b/arch/arm64/kvm/mmio.c >>> index 3dd38a151d2a6..0692f8b18f35c 100644 >>> --- a/arch/arm64/kvm/mmio.c >>> +++ b/arch/arm64/kvm/mmio.c >>> @@ -81,8 +81,8 @@ unsigned long kvm_mmio_read_buf(const void *buf, >>> unsigned int len) >>> int kvm_handle_mmio_return(struct kvm_vcpu *vcpu) >>> { >>> unsigned long data; >>> + unsigned long mask; >>> unsigned int len; >>> - int mask; >>> /* Detect an already handled MMIO return */ >>> if (unlikely(!vcpu->mmio_needed)) >>> @@ -97,7 +97,7 @@ int kvm_handle_mmio_return(struct kvm_vcpu *vcpu) >>> data = kvm_mmio_read_buf(run->mmio.data, len); >>> if (kvm_vcpu_dabt_issext(vcpu) && >>> - len < sizeof(unsigned long)) { >>> + len <= sizeof(unsigned long)) { >> >> If you're reading an 8 byte quantity, what is there to sign-extend? >> Sign extension only makes sense if what you're reading is *smaller* >> than the size of the register you are targeting. >> > > Yes, you are correct, sorry for my bad patch. > Please ignore this patch. > >> I must be missing something. And how is that related to running BE? BE >> in the host? The guest? > > I mean BE is for guest running with BE mode. So what problem did you see? If you have noticed something going wrong, I'd like to get it fixed. Thanks, M. -- Jazz is not dead. It just smells funny... _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel