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 X-Spam-Level: X-Spam-Status: No, score=-0.7 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 747EAC47254 for ; Tue, 5 May 2020 17:17:53 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 26355206E6 for ; Tue, 5 May 2020 17:17:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="AuCOgJky"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="UdfGkBCa" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 26355206E6 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=9wJQJKsM3mZ9APfiNe7mU0DMUi1AybkGhCCqr7M4InI=; b=AuCOgJkyaolXeP xjJ6K4vWYZ/bH1Eb/GkPlDB4IQpOTXgXQGZM8hXr1mm+gSS/vXqlvmOfipUv4JERzykL7Yrk9Kkiv y8Ge1Vh+s7fPtUNRfm5yi6opfx+Vdwfs7bUIzVRwhLFCnNiYckcfj2lDLepnp5Ezdhqx0GMPGwpyh WgRLPplvtIIPgoFUpZtFCU+uXwxbt/0hjr+yMxSxvV7KQBEws9g98sRj6UKcn/bn6LnTim+vDojMS k/WHz+9sxTX8Bs/1IGHukSZZddVqcEM6j1vKN27BLZGfYFBs/FFW/mtoImkpDkczXCWBV+AjMtkRX 7F+E8sgZmjVHM229nKDg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jW1Ca-0000XU-0X; Tue, 05 May 2020 17:17:52 +0000 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jW1BO-00084W-2W for linux-arm-kernel@lists.infradead.org; Tue, 05 May 2020 17:16:40 +0000 Received: by mail-wm1-x343.google.com with SMTP id r26so3237371wmh.0 for ; Tue, 05 May 2020 10:16:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=j/K4PATbLRvXzOHJ5kuvFj7wv+7GxYy2AO2wgULDc48=; b=UdfGkBCaEekX1+Ogl521QElFibeK4JEuXmv+9Qyn1i1eO1zr1X48fFX03epvhY+IY6 ndvidFnMb1LphudrcVRhoWifpNWD22iZNraDpuomYuRhOEn76EjZ3b9SSDCBtT8Y4GQ7 jt6vabzBm6D8UD+o4kzd9GJibXajbtWD8IdhX9Lmgfrh0w0ORRwY8fXa2Ya6/ryu3evu SBcPxJ45+56nOeQDG0Egjl56sijaUTDF0SJfEaOmqBuxiSyv38xKB49H6095OwlH+Mad 6s4qyd1ojEeGZwrkhd05xwnwU2rFCDNGqF17NcmacWdRCjdzQak93yG3czezNQwM0bZg /ISA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=j/K4PATbLRvXzOHJ5kuvFj7wv+7GxYy2AO2wgULDc48=; b=umQrNrin9R4AWxBqEP50NNb1PZgm1OssQ63ykQQfdrdOSm5JSCa4yPzLDm2WcKqqOh DC5CWvsUvY1KiNBW44S9XGo8KUWgPTZY73WrNZhpB3VyKjq7so9WqeeGhqTFp2DI9l0Q hup0wo+fZEXKcoX+CuaYObFHInullZMsWQThm0ECVnBo25Db0c+KwWY51bYKwpve+U+r /YmlopR4TzyBvLECxEtrFPAVQIAKXCfNYB+bwjLSTGg856H0aw3qc2/QlwQZNfpjWG05 PS6yBvjUa6Hdkh7E8JamuDlXCP3kuRQQ+nEXz3C78YFkoZKk+kFFCQCWWUOdv6BcL0m3 BE9A== X-Gm-Message-State: AGi0PuaAFPowsO3M5FcH3eSVfkwBhPVliD3pqVoj48eGAUbelOaHVqlo LTalyEncPAX3EQzaYiz8YIcqgQ== X-Google-Smtp-Source: APiQypLAF/GA9/GggAGCjJYWWbPUt/ZLtlJkLB0SJTpOIVPoR1ng5wPO0c9UIGGAGmCzyMuR7y9mNA== X-Received: by 2002:a1c:3c87:: with SMTP id j129mr4234274wma.157.1588698996194; Tue, 05 May 2020 10:16:36 -0700 (PDT) Received: from google.com ([2a00:79e0:d:109:355c:447d:ad3d:ac5c]) by smtp.gmail.com with ESMTPSA id z22sm4692812wma.20.2020.05.05.10.16.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 May 2020 10:16:35 -0700 (PDT) Date: Tue, 5 May 2020 18:16:31 +0100 From: Andrew Scull To: Marc Zyngier Subject: Re: [PATCH 06/26] arm64: Add level-hinted TLB invalidation helper Message-ID: <20200505171631.GC237572@google.com> References: <20200422120050.3693593-1-maz@kernel.org> <20200422120050.3693593-7-maz@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200422120050.3693593-7-maz@kernel.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200505_101638_175781_EE877637 X-CRM114-Status: GOOD ( 13.40 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kvm@vger.kernel.org, Andre Przywara , kvmarm@lists.cs.columbia.edu, George Cherian , "Zengtao \(B\)" , Catalin Marinas , Will Deacon , Dave Martin , linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org > +#define __tlbi_level(op, addr, level) \ > + do { \ > + u64 arg = addr; \ > + \ > + if (cpus_have_const_cap(ARM64_HAS_ARMv8_4_TTL) && \ > + level) { \ > + u64 ttl = level; \ > + \ > + switch (PAGE_SIZE) { \ > + case SZ_4K: \ > + ttl |= 1 << 2; \ > + break; \ > + case SZ_16K: \ > + ttl |= 2 << 2; \ > + break; \ > + case SZ_64K: \ > + ttl |= 3 << 2; \ > + break; \ > + } \ > + \ > + arg &= ~TLBI_TTL_MASK; \ > + arg |= FIELD_PREP(TLBI_TTL_MASK, ttl); \ Despite the spec saying both tables apply to TLB maintenance instructions that do not apply to a range of addresses I think it only means the 4-bit version (bug report to Arm, or I'm on the wrong spec). This is consistent with Table D5-53 and the macro takes a single address argument to make misuse with range based tlbi less likely. It relies on the caller to get the level right and getting it wrong could be pretty bad as the spec says all bets are off in that case. Is it worth adding a check of the level against the address (seems a bit involved), or that it is just 2 bits or adding a short doc comment to explain it? (Looks like we get some constants for the levels in a later patch that could be referenced with some form of time travel) > + } \ > + \ > + __tlbi(op, arg); \ cosmetic nit: double space in here _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel