Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp604059imm; Fri, 15 Jun 2018 03:19:01 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKsEclhHmBqz6R+/nrP7Lo0ET4Au1j90/Xhv4j+4UUG77itTpfa+dJU3QFgG/V89i2aNUJJ X-Received: by 2002:a17:902:530e:: with SMTP id b14-v6mr1329708pli.316.1529057941830; Fri, 15 Jun 2018 03:19:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529057941; cv=none; d=google.com; s=arc-20160816; b=fZPCSgunVSQ3R03jKJFqT+hFO/7RP6trIKeFrqHswMnQgOeelog2i9ZhPnbm6uu2U5 uNvWs5KwQ7dRL6049YhSb1EakntZHzx7EcIUqxJS+qoEpQbZIbOd+3aS6UuiL3DCSpGG voLmqyOI3LfRy1iIXTcOxg8zz/9B9oVuWuzoy/MxcbgZEO3rB4t8GlqpKwZ3jViuMEG9 PA+NNNtoIX+KdiPBnn5dvDQ/0tCoWNNnksOew17NiI/xeWxiuX9MKVVQ97hZm3ptY6BR DWWm1jfmf1fiRmndGZMCYZcFHhYbNMVGHvlGxgPJFy3Qwhgc/F4fBiUbrF/v6n/P4Rqb 69Lg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=RjyAHm2YFZp6c1Kd4pcMgpUkm9oDCHxn40xrhawEWi0=; b=Zeb3g6ddVx0OMd+pgh8ZpnMqNEAQComEclWeN7dlTXTxmjKv3URek2FT6dusLHzdq6 WL52qMWVcAOUl5/qwfG7ernXmC4ocF7wzG+y7U6Dnev13S47wbhQ4j3b1x5KBNVVMvp2 mZX3naWXEDgq8lhS5pD+KECxo4eQaE3GAS/Y4qvZtvmGz5Y/qnrJ8sGmgz1UU8nh7Si3 Wn2KeOl9tLA8qC3iupgxMmEocGMGDUFVZ1WQSpU+EK8i4CvbLI/EZupFNa2vdsny2FMT O18ZYdTDFh+EL7fNseV4K/6Jn2+9wv2/qZtuBj8uN8nn5pWgW9mYGQ838CmCHQ0liins V1jw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h6-v6si6088414pgq.612.2018.06.15.03.18.46; Fri, 15 Jun 2018 03:19:01 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S936278AbeFOKQy (ORCPT + 99 others); Fri, 15 Jun 2018 06:16:54 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:40750 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934900AbeFOKQu (ORCPT ); Fri, 15 Jun 2018 06:16:50 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 19F381529; Fri, 15 Jun 2018 03:16:50 -0700 (PDT) Received: from [10.1.206.73] (en101.cambridge.arm.com [10.1.206.73]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 7183C3F557; Fri, 15 Jun 2018 03:16:47 -0700 (PDT) Subject: Re: [PATCH v4 02/26] arm64: cpufeature: Add cpufeature for IRQ priority masking To: Julien Thierry , linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org, daniel.thompson@linaro.org, joel@joelfernandes.org, marc.zyngier@arm.com, mark.rutland@arm.com, christoffer.dall@arm.com, james.morse@arm.com, catalin.marinas@arm.com, will.deacon@arm.com References: <1527241772-48007-1-git-send-email-julien.thierry@arm.com> <1527241772-48007-3-git-send-email-julien.thierry@arm.com> <54ff6127-928d-99a3-a6e9-59799628ca87@arm.com> <3f0afa54-8e98-798e-68dc-bbbc74bd9e19@arm.com> From: Suzuki K Poulose Message-ID: <9b87c045-e925-a412-f750-ef2c94e50de5@arm.com> Date: Fri, 15 Jun 2018 11:16:45 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12/06/18 14:46, Julien Thierry wrote: > > > On 25/05/18 11:48, Julien Thierry wrote: >> >> >> On 25/05/18 11:41, Suzuki K Poulose wrote: >>> On 25/05/18 11:39, Julien Thierry wrote: >>>> >>>> >>>> On 25/05/18 11:36, Suzuki K Poulose wrote: >>>>> On 25/05/18 11:17, Julien Thierry wrote: >>>>>> >>>>>> >>>>>> On 25/05/18 11:04, Suzuki K Poulose wrote: >>>>>>> On 25/05/18 10:49, Julien Thierry wrote: >>>>>>>> Add a cpufeature indicating whether a cpu supports masking interrupts >>>>>>>> by priority. >>>>>>> >>>>>>> How is this different from the SYSREG_GIC_CPUIF cap ? Is it just >>>>>>> the description ? >>>>>> >>>>>> More or less. >>>>>> >>>>>> It is just to have an easier condition in the rest of the series. Basically the PRIO masking feature is enabled if we have a GICv3 CPUIF working *and* the option was selected at build time. Before this meant that I was checking for the GIC_CPUIF cap inside #ifdefs (and putting alternatives depending on that inside #ifdefs as well). >>>>>> >>>>>> Having this as a separate feature feels easier to manage in the code. It also makes it clearer at boot time that the kernel will be using irq priorities (although I admit it was not the initial intention): >>>>>> >>>>>> [    0.000000] CPU features: detected: IRQ priority masking >>>>>> >>>>>> >>>>>> But yes that new feature will be detected only if SYSREG_GIC_CPUIF gets detected as well. >>>>> >>>>> Well, you could always wrap the check like : >>>>> >>>>> static inline bool system_has_irq_priority_masking(void) >>>>> { >>>>>      return (IS_ENABLED(CONFIG_YOUR_CONFIG) && cpus_have_const_cap(HWCAP_SYSREG_GIC_CPUIF)); >>>>> } >>>>> >>>>> and use it everywhere. >>>>> >>>> >>>> Yes, but I can't use that in the asm parts that use alternatives and would need to surround them in #ifdef... :\ >>> >>> I thought there is _ALTERNATIVE_CFG() to base the alternative depend on a CONFIG_xxx ? >>> Doesn't that solve the problem ? >> >> Right, I didn't see that one. It should work yes. >> >> I'll try that when working on the next version. > > I've been trying to use this now, but I can't figure out how. > > The _ALTERNATIVE_CFG does not seem to work in assembly code (despite having its own definition for __ASSEMBLY__), and the alternative_insn does not seem to be suited for instructions that take operands (or more than one operand) > > If I am mistaken, can you provide an example of how to use this in assembly with instructions having more than 1 operand? I am sorry, but I think the ALTERNATIVE_CFG is not the right one, as it omits the entire block, if the CONFIG is not enabled. So you are left with only three choices : 1) Use alternative call back 2) Stick to two separate caps. 3) Use #ifdef Cheers Suzuki