Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1016668rwb; Wed, 9 Nov 2022 11:32:40 -0800 (PST) X-Google-Smtp-Source: AMsMyM5DqwY+6JdFA/V2wLdhCjAks+Q/Za2oaz1Spm4PpdTa+4JzU2AKTESspomsKBlimvmapxYS X-Received: by 2002:a17:906:3b17:b0:7ad:b645:9e3e with SMTP id g23-20020a1709063b1700b007adb6459e3emr53788005ejf.140.1668022359733; Wed, 09 Nov 2022 11:32:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668022359; cv=none; d=google.com; s=arc-20160816; b=lQd1sgtAhk7/zgIIZd9cpGf60DLorCze38ooEWyrmvY+pgKavw9DKBJ+UcbdFItWlJ 2c/Y9CnX3To8K+P32YNmAoQTo/3O8/Y/Kp7SyWAl9XG45ejDGcMyQuTUebVr7+lS9jgc koyi/lv14VXnjoUHuDhFRuUzQXdld9367kpysZ0fdJnV8cTYueTeD6XNgZ/0k8qP++JP vsyLJx4SOna2FP/BmrbMA5gZPi7ZWirLu5ia/Wch79w59m020qMiNu0oBuzTllm4qgQU K3S/Cy9wOwY/bzXEgUfO7IAc4MqmEXyhNHothOK6oYxk45Z894M4TuhFLodFL7fuQKv7 K0Qg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=21Y7otSo7EfgL/SQW9mD+GJby5MTJfUFXrgaRZogR1o=; b=M4WUSvVy2D95pnx+JYbg/wH1h7sB0+ElR1VfwmXJz9+/+LcAPvzlCSzt8s3m0YLU27 RLqOaABZphPR3GBUpv/62YAWv4oBEb2bfvUjlDpvliLbCbrznXUz3/ZyIeJ04iuAQ6J6 Y94HMBKikQKNWLVdFxigY+XHJvTB+IYnvqQBHogGsQDUbbQHFUGwx1qv2tOnsm9Ebbi7 7mRrb+1pl8F2mxNvR3kLfS0hdtAT+xTQDJcmBDDWi07exm9DnIDlp6w4ry1NQOjPsOKM vo7ha+LBTYu2GfM1SRFHIHrXs7lVTu6HzkMg8czlzXRjicenqDGn1MdhvJy+2AHFxr0y gPUg== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cw16-20020a056402229000b0046276ef250asi14207630edb.298.2022.11.09.11.32.17; Wed, 09 Nov 2022 11:32:39 -0800 (PST) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231703AbiKITSv (ORCPT + 92 others); Wed, 9 Nov 2022 14:18:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57240 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229915AbiKITSu (ORCPT ); Wed, 9 Nov 2022 14:18:50 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5CA91633F; Wed, 9 Nov 2022 11:18:49 -0800 (PST) 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 dfw.source.kernel.org (Postfix) with ESMTPS id 8FC3561C9A; Wed, 9 Nov 2022 19:18:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3B3F3C433D6; Wed, 9 Nov 2022 19:18:46 +0000 (UTC) Date: Wed, 9 Nov 2022 19:18:42 +0000 From: Catalin Marinas To: Anshuman Khandual Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, will@kernel.org, Suzuki K Poulose , James Morse , Jonathan Corbet , Mark Rutland , linux-doc@vger.kernel.org Subject: Re: [PATCH 2/2] arm64: errata: Workaround possible Cortex-A715 [ESR|FAR]_ELx corruption Message-ID: References: <20221027023915.1318100-1-anshuman.khandual@arm.com> <20221027023915.1318100-3-anshuman.khandual@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221027023915.1318100-3-anshuman.khandual@arm.com> X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS 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 On Thu, Oct 27, 2022 at 08:09:15AM +0530, Anshuman Khandual wrote: > +#define __HAVE_ARCH_PTEP_MODIFY_PROT_TRANSACTION > +static inline pte_t ptep_modify_prot_start(struct vm_area_struct *vma, > + unsigned long addr, > + pte_t *ptep) > +{ > + pte_t pte = ptep_get_and_clear(vma->vm_mm, addr, ptep); > > + if (IS_ENABLED(CONFIG_ARM64_WORKAROUND_2645198)) { > + /* > + * Break-before-make (BBM) is required for all user space mappings > + * when the permission changes from executable to non-executable > + * in cases where cpu is affected with errata #2645198. > + */ > + if (pte_user_exec(pte) && cpus_have_const_cap(ARM64_WORKAROUND_2645198)) > + __flush_tlb_range(vma, addr, addr + PAGE_SIZE, PAGE_SIZE, false, 3); Why not flush_tlb_page() here? But more importantly, can we not use ptep_clear_flush() instead (and huge_ptep_clear_flush())? They return the pte and do the TLBI. -- Catalin