Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933378AbbELPG2 (ORCPT ); Tue, 12 May 2015 11:06:28 -0400 Received: from mail-by2on0146.outbound.protection.outlook.com ([207.46.100.146]:11010 "EHLO na01-by2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932537AbbELPGZ (ORCPT ); Tue, 12 May 2015 11:06:25 -0400 Authentication-Results: spf=none (sender IP is 165.204.84.221) smtp.mailfrom=amd.com; arm.com; dkim=none (message not signed) header.d=none; X-WSS-ID: 0NO8SMK-07-7ID-02 X-M-MSG: Message-ID: <555216D9.30506@amd.com> Date: Tue, 12 May 2015 10:06:01 -0500 From: Suravee Suthikulanit User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: "Rafael J. Wysocki" , Catalin Marinas CC: , , , , , , , , , , , , , , , , Subject: Re: [V3 PATCH 1/5] ACPI / scan: Parse _CCA and setup device coherency References: <1431045436-8690-1-git-send-email-Suravee.Suthikulpanit@amd.com> <3684853.vaQGhc4jR5@vostro.rjw.lan> <20150511161626.GI18655@e104818-lin.cambridge.arm.com> <1664523.WMm4AqWTY5@vostro.rjw.lan> In-Reply-To: <1664523.WMm4AqWTY5@vostro.rjw.lan> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1;BL2FFO11FD013;1:J0A6Pn1qEkmiSVsMVAiaG9hHSBda3a6x0vekhHBkkeOdmCmUYP7/PNW/FMKfTgajtV9QX+ABJn8RQZuqOyvM2lYAyTe0sP9E1KElepsEuo1gRs/LLWq8J5akMga7sSnAewUUnIjhbvvM3hNK+KzFMxtd6E6JrBWpzpwZVzgbDbOJnPFEZ19IUWCrC6Yw3k/J8Bff7i2sNCRdVVtamvg1FMTcPvrCBfFKz6MSJZNkjpWXslrkgadwhsJULshstGs1uYisj9hjsTedh5/7eLhX4AHvBBIfEveYBDy3RIZVUx4ePoYW8em1sefmYfwpnt1Y X-Forefront-Antispam-Report: CIP:165.204.84.221;CTRY:US;IPV:NLI;EFV:NLI;SFV:NSPM;SFS:(10019020)(979002)(6009001)(428002)(189002)(51704005)(164054003)(377454003)(199003)(479174004)(24454002)(101416001)(65816999)(64126003)(76176999)(54356999)(50986999)(36756003)(105586002)(46102003)(120886001)(106466001)(86362001)(77096005)(83506001)(47776003)(65956001)(65806001)(62966003)(77156002)(23676002)(87936001)(4001350100001)(2950100001)(92566002)(93886004)(33656002)(189998001)(50466002)(5001770100001)(21314002)(969003)(989001)(999001)(1009001)(1019001);DIR:OUT;SFP:1102;SCL:1;SRVR:CO1PR02MB080;H:atltwp01.amd.com;FPR:;SPF:None;MLV:ovrnspm;MX:1;A:1;PTR:InfoDomainNonexistent;LANG:en; X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:CO1PR02MB080; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(5005006)(3002001);SRVR:CO1PR02MB080;BCL:0;PCL:0;RULEID:;SRVR:CO1PR02MB080; X-Forefront-PRVS: 0574D4712B X-OriginatorOrg: amd4.onmicrosoft.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 May 2015 15:06:21.7158 (UTC) X-MS-Exchange-CrossTenant-Id: fde4dada-be84-483f-92cc-e026cbee8e96 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=fde4dada-be84-483f-92cc-e026cbee8e96;Ip=[165.204.84.221];Helo=[atltwp01.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR02MB080 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2871 Lines: 77 On 5/11/2015 8:20 PM, Rafael J. Wysocki wrote: > On Monday, May 11, 2015 05:16:27 PM Catalin Marinas wrote: >> On Fri, May 08, 2015 at 10:53:59PM +0200, Rafael J. Wysocki wrote: >>> On Thursday, May 07, 2015 07:37:12 PM Suravee Suthikulpanit wrote: >>>> diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig >>>> index ab2cbb5..7822149 100644 >>>> --- a/drivers/acpi/Kconfig >>>> +++ b/drivers/acpi/Kconfig >>>> @@ -54,6 +54,12 @@ config ACPI_GENERIC_GSI >>>> config ACPI_SYSTEM_POWER_STATES_SUPPORT >>>> bool >>>> >>>> +config ACPI_CCA_REQUIRED >>>> + bool >>>> + >>>> +config ARM64_SUPPORT_ACPI_CCA_ZERO >>> >>> Hmm. I guess the Arnd's idea what to simply use CONFIG_ARM64 directly instead >>> of adding this new option. >> >> I agree. >> >>>> +static inline bool acpi_dma_is_supported(struct acpi_device *adev) >>>> +{ >>>> + /** >>>> + * Currently, we mainly support _CCA=1 (i.e. is_coherent=1) >>>> + * This should be equivalent to specifyig dma-coherent for >>>> + * a device in OF. >>>> + * >>>> + * For the case when _CCA=0 (i.e. is_coherent=0 && cca_seen=1), >>>> + * we would rely on arch-specific cache maintenance for >>>> + * non-coherence DMA operations if architecture specifies >>>> + * _XXX_SUPPORT_CCA_ZERO. Otherwise, we do not support >>>> + * DMA on this device and fallback to arch-specific default >>>> + * handling. >>>> + * >>>> + * For the case when _CCA is missing (i.e. cca_seen=0) but >>>> + * platform specifies ACPI_CCA_REQUIRED, we do not support DMA, >>>> + * and fallback to arch-specific default handling. >>>> + */ >>>> + return adev && (adev->flags.is_coherent || >>>> + (adev->flags.cca_seen && >>>> + IS_ENABLED(CONFIG_ARM64_SUPPORT_ACPI_CCA_ZERO))); >>> >>> So what exactly would be wrong with using IS_ENABLED(CONFIG_ARM64) here? >> >> I'm not sure I follow why we need to check for ARM64 here at all. Can we >> not just have something like: >> >> return adev && (!IS_ENABLED(CONFIG_ACPI_CCA_REQUIRED) || >> adev->flags.cca_seen) > > If _CCA returns 0 on non-ARM64, DMA is not supported for this device, so > in that case the function should return 'false' while the above check will > make it return 'true'. > The main idea is basically to allow architecture to decide if it wants to specify if it wants to support _CCA=0. Currently, there are two approaches. 1. Do not support and disable DMA 2. Support and default to what architecture would normally do for non-coherent DMA. Since, ARM64 being the only platform, which supports ACPI and would support _CCA=0. I can just put CONFIG_ARM64 then as Arnd and Rafael mentioned. Thanks, Suravee -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/