Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp779661iog; Thu, 30 Jun 2022 09:59:57 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uk8KnqB8CpE4aZ0bmzi1OBL2juFXh1ytWP59cfBCmjLNU4WaLlfGi1mtnHv2m/l1q817t+ X-Received: by 2002:a17:907:6e06:b0:726:29f0:78d5 with SMTP id sd6-20020a1709076e0600b0072629f078d5mr10216275ejc.186.1656608396851; Thu, 30 Jun 2022 09:59:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656608396; cv=none; d=google.com; s=arc-20160816; b=PD3rdPkHCNghkhPOqNc9MY4eAxqwaBqSfmnsCsPDPtLGdaFZ8zqBKMNT+y1kJn3gFW 9wX79KKrhpEiKxb890R5Z6w2dvVxP74kxMYtZEnx5H+GRKjklxMDv/7rFvlRQh7oWkOx y2HTZHPeeSzzzdpe07lpWckZ+c2bNbd1zwt00aqC42zAztd2tI9pxKhVeuawHF4aV6zw o54F082Ls7uIbr4/BdkCF7okcu7FQkC9HwCvPhPT9vF+l5J1+y0hrM2dX/vOtHorNxOp wJP3+L5qfaWxRqJqHou63IqHKbHSrMQke8pHSTiMKavGoJBCboNL+GLLncqf6xd1Q193 9VQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:in-reply-to:date:subject :cc:to:from:user-agent:references:dkim-signature; bh=3yzQoY2ucWrQqXREQTyNPjG4X86W8VdDP00R8nZTgn0=; b=Sq7c+oG2tDu8YQj3Z+nxlmj/ViGzrVoim8kFq0LoEBbl3A1SDhBXVX4lFg9H1Gya/i bigQTCDaagScl2GpyWBTk+m3FcZ/COFdGQcGWtCB1MzBbCNqEKCphxKKdZf4Xz8+kCIl 6wD1aJ9laxaYeRpCQNKvEGwcILEGvvNV1Tnq9vbCaE6+rfz8YjTRutWWT4hAYQfnjAe2 DpCgSzrH350QScH9FazUn4gprE74Qfh9sh8fpPwsw/d4+Vv6XBxOcLAk/JlK+zdv15Bg dANbXF68kVVBy6ueFmsYkM1qvJSNvQT9RtefxPiQ48vInTy6PlVzQm+VdmubOLL0sy4c OHgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=gKHIqcp0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dr17-20020a170907721100b00726d677eb74si3025808ejc.210.2022.06.30.09.59.29; Thu, 30 Jun 2022 09:59:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=gKHIqcp0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235512AbiF3Qy6 (ORCPT + 99 others); Thu, 30 Jun 2022 12:54:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55238 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232887AbiF3Qy5 (ORCPT ); Thu, 30 Jun 2022 12:54:57 -0400 Received: from mail-io1-xd34.google.com (mail-io1-xd34.google.com [IPv6:2607:f8b0:4864:20::d34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1BDC4393DC for ; Thu, 30 Jun 2022 09:54:56 -0700 (PDT) Received: by mail-io1-xd34.google.com with SMTP id s17so19709512iob.7 for ; Thu, 30 Jun 2022 09:54:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=references:user-agent:from:to:cc:subject:date:in-reply-to :message-id:mime-version; bh=3yzQoY2ucWrQqXREQTyNPjG4X86W8VdDP00R8nZTgn0=; b=gKHIqcp0AXkJmHeV5RhLZd4icY5aYh4HmgWSU7ggoO73jfesxxLYVvV03O8gLsc2g5 +cOwbiWrWLrnxa5Ivba04k23sLZ/VzDqvVJGxIuNRO5EFyAaZT8XPV48zebXLz7r3zPE nRM+1xIjvy9uFrtZkqNlL92HXCv2ysiQc2OBuTiijyC60csdeQWNQUric+SODQoFdcNO +f5AT3XUhy8XYk6g7mLvG0i5OjWUMLHCs5JRBTmY/dYg2Bx0dAaSfEcVomqUN6GSSFmM bFdS0Oweb2Xt6h1Wo2E36OtoM61U2v81mUipbJ64BoAnv3q3w5ZV7NEw6i9ETiEp66jF dXsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:references:user-agent:from:to:cc:subject:date :in-reply-to:message-id:mime-version; bh=3yzQoY2ucWrQqXREQTyNPjG4X86W8VdDP00R8nZTgn0=; b=0vN+jm288QKAzUMGr+qKkve/NAxQFBup1ryvC8wt3N+UXuB1Vbg9Y52R4QI+3XLy6z olexXYUgb4uAPL9DN/ceGSxTUOaitovJI51w08tC9rIvmAjwZ47Iz0smgamvq1Thjunf tfT2y7zM/cutoIH5CB6TGnWXTjQvQK+8SpFDBboue0Hrd8eCqGrU56RRF5ljmL75KOO9 //vdzlprB27f2VhaLLZeyOA0NQfPTXVgQAC+06gltaPMRJmKjkOaUrYOzLRrHM/eLdRE pxM6Fztt0FlBEKqpqP42RGLTsG11d4Qt5/T+aishp6K55pGXjwuB4Faacxobs9LPHZqO fXfw== X-Gm-Message-State: AJIora8o043UJzKUcuIMjGwTlF6Ed0q98GN7NWZpwwWMV1cvTCbDPmxK iyh2UVWBK5pE4mvXZtOZ95c/8ufMKq4BCg== X-Received: by 2002:a05:6638:1a8d:b0:33c:9a98:ff2d with SMTP id ce13-20020a0566381a8d00b0033c9a98ff2dmr6243491jab.31.1656608095139; Thu, 30 Jun 2022 09:54:55 -0700 (PDT) Received: from ArchLinux ([240e:390:a20:ece0:3ad5:47ff:feb5:73b2]) by smtp.gmail.com with ESMTPSA id p7-20020a02b007000000b00339dd3976absm8723936jah.110.2022.06.30.09.54.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Jun 2022 09:54:54 -0700 (PDT) References: <20220630161220.53449-1-schspa@gmail.com> <87mtdu15ok.wl-maz@kernel.org> User-agent: mu4e 1.7.5; emacs 28.1 From: Schspa Shi To: Marc Zyngier 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 Date: Fri, 01 Jul 2022 00:50:59 +0800 In-reply-to: <87mtdu15ok.wl-maz@kernel.org> Message-ID: MIME-Version: 1.0 Content-Type: text/plain; format=flowed X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. > > Please convince me. > > M. -- BRs Schspa Shi