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=-8.0 required=3.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham 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 F0AF9C47404 for ; Wed, 9 Oct 2019 06:30:05 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 8EE8A21835 for ; Wed, 9 Oct 2019 06:30:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="gCAsZizJ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8EE8A21835 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id F1F828E0005; Wed, 9 Oct 2019 02:30:04 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id ED1168E0003; Wed, 9 Oct 2019 02:30:04 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DBE558E0005; Wed, 9 Oct 2019 02:30:04 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0202.hostedemail.com [216.40.44.202]) by kanga.kvack.org (Postfix) with ESMTP id B49268E0003 for ; Wed, 9 Oct 2019 02:30:04 -0400 (EDT) Received: from smtpin06.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with SMTP id 4922268BE for ; Wed, 9 Oct 2019 06:30:04 +0000 (UTC) X-FDA: 76023271128.06.ice21_57da800176d0a X-HE-Tag: ice21_57da800176d0a X-Filterd-Recvd-Size: 7101 Received: from mail-pl1-f196.google.com (mail-pl1-f196.google.com [209.85.214.196]) by imf32.hostedemail.com (Postfix) with ESMTP for ; Wed, 9 Oct 2019 06:30:03 +0000 (UTC) Received: by mail-pl1-f196.google.com with SMTP id q24so536650plr.13 for ; Tue, 08 Oct 2019 23:30:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=w68/orlNscWNc/RUeRC/f2rPS8rnm+VfnzeAEKq1oho=; b=gCAsZizJ9a3a0D5hVnAfZkm/iL5uzpK6VAqTpzgEYwlxQ+3u652p3Y/VZBqO7FveWB Nq7EMGtdS4MC0QctnX0zHCHDvhnZYkGf941vE1ny/Ht9sX3Iq2kywSAR51MHKQWG1Ph4 BUWNHY6OXqwubIpbWNafpxMIPZKcVg3f5OYwHMQ/rHHrjD0PmvvF6RHNsqXDzXzM65Jn XJP6RWKqNo0xUZDdqVVeGkLGlrfNu0pzbx68EYCiGEu6VKlp3PYFn4QdUAiBlwNFwiTM ULODzh/thFVYThjDakFi0rHFgulQUW7mX3lqdoGjCH98NZJdvXa/BVPCi7Cj+WAwQW3c 6ohw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=w68/orlNscWNc/RUeRC/f2rPS8rnm+VfnzeAEKq1oho=; b=tMzvNRwXfAu9TrE3MNX3KqQmzOeYMN2rEYPyxrd/CXOxg/Zd+xvLjaMs1EzohSZuNA Y/AX5rlWLCQVVpCuAmGIDyNxwkHAjk2PzXmhDQt1zpSa3/jdLZp12g4w2LrSi5V6ZuhH KB8CFSPkTbfi6HMs9srdw8ajpY2QZn5WpeJQ1buQheMV3ycANFNXA1ozmnImfVca8PKs WhSG8PZVqR+iA+E8yVYhqrq1LBC/EwTmtnocxeJvG5/NPIx4HrQYrUpAAcOc1c45Bs7l 4kVmLyxC8pyvR3OWZZmsP6YArBk/WmnW3svikrErSRt5DQSF25RzNKbKaHE1HWO1X7mF 9XZw== X-Gm-Message-State: APjAAAUbyWDDEcDYrExEttuwmrLp0Tj0vfwtLgiPdJ5344xc15wDmBc5 QaY6lelVy1oFp3ScJ6gWiHA= X-Google-Smtp-Source: APXvYqxkfVNDvqvamqZYmknXHRyR5WvVmjl5du1D4+hbKLSxzIltzJwTMLTMlINKS6fH0aPAUAiFVg== X-Received: by 2002:a17:902:8d89:: with SMTP id v9mr1528070plo.247.1570602602062; Tue, 08 Oct 2019 23:30:02 -0700 (PDT) Received: from [0.0.0.0] (104.129.187.94.16clouds.com. [104.129.187.94]) by smtp.gmail.com with ESMTPSA id f185sm1284523pfb.183.2019.10.08.23.29.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 Oct 2019 23:30:00 -0700 (PDT) Subject: Re: [PATCH v10 1/3] arm64: cpufeature: introduce helper cpu_has_hw_af() To: Suzuki K Poulose , "Justin He (Arm Technology China)" , Marc Zyngier , Will Deacon Cc: Mark Rutland , "Kaly Xin (Arm Technology China)" , Catalin Marinas , "linux-kernel@vger.kernel.org" , Matthew Wilcox , "linux-mm@kvack.org" , James Morse , "linux-arm-kernel@lists.infradead.org" , Punit Agrawal , Thomas Gleixner , Andrew Morton , "Kirill A. Shutemov" References: <20190930015740.84362-1-justin.he@arm.com> <20190930015740.84362-2-justin.he@arm.com> <20191001125446.gknoofnm7az4wqf5@willie-the-truck> <20191001141848.762296bd@why> From: Jia He Message-ID: <1b28b20c-bc10-dbf6-aa78-afd985cf8920@gmail.com> Date: Wed, 9 Oct 2019 14:29:42 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Hi Suzuki On 2019/10/8 23:32, Suzuki K Poulose wrote: > > > On 08/10/2019 02:12, Justin He (Arm Technology China) wrote: >> Hi Will and Marc >> Sorry for the late response, just came back from a vacation. >> >>> -----Original Message----- >>> From: Marc Zyngier >>> Sent: 2019=E5=B9=B410=E6=9C=881=E6=97=A5 21:19 >>> To: Will Deacon >>> Cc: Justin He (Arm Technology China) ; Catalin >>> Marinas ; Mark Rutland >>> ; James Morse ; >>> Matthew Wilcox ; Kirill A. Shutemov >>> ; linux-arm-kernel@lists.infradead.o= rg; >>> linux-kernel@vger.kernel.org; linux-mm@kvack.org; Punit Agrawal >>> ; Thomas Gleixner ; >>> Andrew Morton ; hejianet@gmail.com; Kaly >>> Xin (Arm Technology China) >>> Subject: Re: [PATCH v10 1/3] arm64: cpufeature: introduce helper >>> cpu_has_hw_af() >>> >>> On Tue, 1 Oct 2019 13:54:47 +0100 >>> Will Deacon wrote: >>> >>>> On Mon, Sep 30, 2019 at 09:57:38AM +0800, Jia He wrote: >>>>> We unconditionally set the HW_AFDBM capability and only enable it o= n >>>>> CPUs which really have the feature. But sometimes we need to know >>>>> whether this cpu has the capability of HW AF. So decouple AF from >>>>> DBM by new helper cpu_has_hw_af(). >>>>> >>>>> Signed-off-by: Jia He >>>>> Suggested-by: Suzuki Poulose >>>>> Reviewed-by: Catalin Marinas >>>>> --- >>>>> =C2=A0 arch/arm64/include/asm/cpufeature.h | 10 ++++++++++ >>>>> =C2=A0 1 file changed, 10 insertions(+) >>>>> >>>>> diff --git a/arch/arm64/include/asm/cpufeature.h >>> b/arch/arm64/include/asm/cpufeature.h >>>>> index 9cde5d2e768f..949bc7c85030 100644 >>>>> --- a/arch/arm64/include/asm/cpufeature.h >>>>> +++ b/arch/arm64/include/asm/cpufeature.h >>>>> @@ -659,6 +659,16 @@ static inline u32 >>> id_aa64mmfr0_parange_to_phys_shift(int parange) >>>>> =C2=A0=C2=A0 default: return CONFIG_ARM64_PA_BITS; >>>>> =C2=A0=C2=A0 } >>>>> =C2=A0 } >>>>> + >>>>> +/* Check whether hardware update of the Access flag is supported *= / >>>>> +static inline bool cpu_has_hw_af(void) >>>>> +{ >>>>> + if (IS_ENABLED(CONFIG_ARM64_HW_AFDBM)) >>>>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return read_cpuid= (ID_AA64MMFR1_EL1) & 0xf; >>>> >>>> 0xf? I think we should have a mask in sysreg.h for this constant. >>> >>> We don't have the mask, but we certainly have the shift. >>> >>> GENMASK(ID_AA64MMFR1_HADBS_SHIFT + 3, >>> ID_AA64MMFR1_HADBS_SHIFT) is a bit >>> of a mouthful though. Ideally, we'd have a helper for that. >>> >> Ok, I will implement the helper if there isn't so far. >> And then replace the 0xf with it. > > Or could we simpl reuse existing cpuid_feature_extract_unsigned_field()= ? > > u64 mmfr1 =3D read_cpuid(ID_AA64MMFR1_EL1); > > return cpuid_feature_extract_unsigned_field(mmfr1, ID_AA64MMFR1_HADBS_S= HIFT) ? > Yes, we can, I will send the new version --- Cheers, Justin (Jia He)