Received: by 10.223.164.202 with SMTP id h10csp4734854wrb; Wed, 29 Nov 2017 10:58:31 -0800 (PST) X-Google-Smtp-Source: AGs4zMaWQqdti4TD5c8rZB+Edlqipa9fnhVWBS86Q8J1NUVuNfmkrr7sP340o6kMO5vJM8K0KhDl X-Received: by 10.84.172.1 with SMTP id m1mr3856917plb.345.1511981911246; Wed, 29 Nov 2017 10:58:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511981911; cv=none; d=google.com; s=arc-20160816; b=EIV8g9putDt98YX+eKe74ub3VGFekD/X80Wf3xD2KjoW2GQi7uV6p8vYd5sN79uPy4 E2kbg+0hFcXcrJAhL3GGOYFDbANF9FuAJFA/1boppzcb75ioFtvhKzGlV9atCpAHw6md 9JAZjz7yYzpsOiAngc3gKxOrMqehWCp4Mn0+vwDepeInEtZxu7IfSab6xQNc3iDIRTQT JmIQ/mGNKwPfLHGEmuv2lcEJFsDwq70WvOfL4LMqi+y0yf2u/V/fne2cq7LqA+i2kIjo kO2MToqDwuXmop3C85SbRC4PjRjJuB7qoFE7vpR35zPZq/Fsta3p2p8unhq747Y+BCbQ M7uA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=QtyjisXWrekDO6BR5f3erSrF5GOuiLGyUZI8FgtY9kU=; b=y9PkVZzm1bBqyontqvEjD8b9AZPSs3mYjDF2YmsxgL8xdW88Jwx/nQU1z24Q8kk4NO Pf3hMiyKlSZZ9uP+Hkp54CeFsPIOgX49gkcdGYfqBCyAsYK7SwqEfiZ7ViWSaAVQjb6H YcmCzNzPbc/OZmcN+webseVBFiDwNLVZXN8Eh4CTlLQl9Nkua0wPhftrXbYGjoGVaUqn fOt+t3ZyLrLltJ80HwhKas6kpS5fo8r/7pOVohg68bEoMg+MJqP5hmFHWU3Y44+kag1q 0CV9XFrKvnB59Xo98Q2GhCNmnv5G7B/0c7XOk4OoMYxUSLYob+BWzhn3y5TCIwG2SSPf 4tPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=crzZAb/2; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 3si1678830pls.794.2017.11.29.10.58.21; Wed, 29 Nov 2017 10:58:31 -0800 (PST) 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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=crzZAb/2; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755109AbdK2OLv (ORCPT + 70 others); Wed, 29 Nov 2017 09:11:51 -0500 Received: from mail-vk0-f65.google.com ([209.85.213.65]:40713 "EHLO mail-vk0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755026AbdK2OL3 (ORCPT ); Wed, 29 Nov 2017 09:11:29 -0500 Received: by mail-vk0-f65.google.com with SMTP id w190so1249004vkd.7; Wed, 29 Nov 2017 06:11:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=QtyjisXWrekDO6BR5f3erSrF5GOuiLGyUZI8FgtY9kU=; b=crzZAb/2SGguQ3rpwclTdqOF/NXH9lLq3QJssq/Sz+ahB8GZ4F8vpKD5SxX5QCgmud bW3Qfu0GWBhHMxYeWBs7+6Ou4drE7/8miXYMHzqFcFAwyUUiDtpL/V9xfQl8uOwz3VFz ZyDM1pPgDd41VKROW4AcIPLfJgS7U6ibx3TYx5pKJT4xkB7wPzQqcBZHUxzy0Pczm9fP 3J7iLGISDzCvbAR26jZKeDsnRMR4wfwN17XrXaXxo2ks3FZVJL8ZJlERNWlEauraiSmw yedx3PG7HjnWFpiEMyvNpzv3iEHlovbA7vcdx/cW++fl2W+2p6QZen/U/Jawi5clxvn+ KT4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=QtyjisXWrekDO6BR5f3erSrF5GOuiLGyUZI8FgtY9kU=; b=X2z+HARAcJ3JzAKB3ni6jsZvbrdCKN1k5r5yvI+1c8xRrmXZ5QGtMz3KeLxvl7jV/V 3ymUMQz/uYP0P5VZbu81bMcGqDhxGf2m4yhGplWnl01kPf29p98JnIk8bfzfHT1Z7nx/ M8QWEeMdTanksI6wm2qvLMieYCs5rlBqdIFsXEjCBs4Y0d4th2u1kbE9TItq0fNAhTqf 82akIL01Y0FdIgLzPhaXyatwAc63jZAfULicvSeRfpl9n3l2MN94PD5eGOPa1QhJ7C0H PZooy6jfQvvkJppsIb32C7T9p3RJqXii8wZdtpe4BT2IB5Ylh9+Be2vMcF8+ireP//z8 nPrg== X-Gm-Message-State: AJaThX6QARSw0jpHMamPAVCGVDyPm3C3cWO4b7+7hPZ832QS8VU6oC9B 2cttWTOR5fI1FUG7i/sFf0BcbJvZDVWlJRSwSL0= X-Received: by 10.31.157.213 with SMTP id g204mr2528639vke.130.1511964688074; Wed, 29 Nov 2017 06:11:28 -0800 (PST) MIME-Version: 1.0 Received: by 10.176.27.105 with HTTP; Wed, 29 Nov 2017 06:10:47 -0800 (PST) In-Reply-To: References: <5e1be9ebc591c6de79b75f726a5a38b2564eaa92.1511785528.git.green.hu@gmail.com> From: Greentime Hu Date: Wed, 29 Nov 2017 22:10:47 +0800 Message-ID: Subject: Re: [PATCH v2 25/35] nds32: Build infrastructure To: Arnd Bergmann Cc: Geert Uytterhoeven , Greentime , Linux Kernel Mailing List , linux-arch , Thomas Gleixner , Jason Cooper , Marc Zyngier , Rob Herring , Networking , Vincent Chen , DTML , Al Viro , David Howells , Will Deacon , Daniel Lezcano , "linux-serial@vger.kernel.org" , Vincent Chen Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 2017-11-29 19:57 GMT+08:00 Arnd Bergmann : > On Wed, Nov 29, 2017 at 12:39 PM, Greentime Hu wrote: >> 2017-11-29 17:25 GMT+08:00 Arnd Bergmann : >>> On Wed, Nov 29, 2017 at 10:10 AM, Geert Uytterhoeven >>> wrote: >>>> Hi Arnd, >>>> >>>> On Wed, Nov 29, 2017 at 9:58 AM, Arnd Bergmann wrote: >>>>> On Wed, Nov 29, 2017 at 9:39 AM, Greentime Hu wrote: >>>>>> 2017-11-27 22:21 GMT+08:00 Arnd Bergmann : >>>>>>> On Mon, Nov 27, 2017 at 1:28 PM, Greentime Hu wrote: >>>>>>>> diff --git a/arch/nds32/Kconfig.cpu b/arch/nds32/Kconfig.cpu >>>>>>>> +config CPU_CACHE_NONALIASING >>>>>>>> + bool "Non-aliasing cache" >>>>>>>> + help >>>>>>>> + If this CPU is using VIPT data cache and its cache way size is larger >>>>>>>> + than page size, say N. If it is using PIPT data cache, say Y. >>>>>>>> + >>>>>>>> + If unsure, say Y. >>>>>>> >>>>>>> Can you determine this from the CPU type? >>>>>> >>>>>> There is no cpu register to determine it. It also depeneds on page >>>>>> size and way size however page size is configurable by software. >>>>>> These codes are determined at compile time will be benefit to code >>>>>> size and performance. >>>>>> IMHO, I think it would be better to be determined here. >>>>> >>>>> I meant determining it at compile time from other Kconfig symbols, >>>>> if that's possible. Do the CPU cores each have a fixed way-size? >>>>> If they do, it could be done like >>>>> >>>>> menu "CPU selection" >>>>> >>>>> config CPU_N15 >>>>> bool "AndesCore N15" >>>>> select CPU_CACHE_NONALIASING >>>>> >>>>> config CPU_N13 >>>>> bool "AndesCore N15" >>>>> select CPU_CACHE_NONALIASING if PAGE_SIZE_16K >>>>> >>>>> ... >>>>> >>>>> endmenu >>>>> >>>>> and then you can use the same CPU_... symbols to make other decisions >>>>> as well, e.g. CPU specific compiler optimizations. >>>> >>>> Do you want to support multiple CPU types in a single kernel image >>>> (I see no "choice" statement above)? >>>> If yes, you may have a mix of aliasing and non-aliasing caches, so >>>> you may want to invert the logic, and select CPU_CACHE_ALIASING >>>> instead. >>> >>> Right, my mistake. >>> >> >> Thanks to Arnd and Geert! >> >> How about this? >> >> choice >> prompt "CPU type" >> default CPU_N13 >> config CPU_N15 >> bool "AndesCore N15" >> select CPU_CACHE_NONALIASING >> config CPU_N13 >> bool "AndesCore N13" >> select CPU_CACHE_NONALIASING if ANDES_PAGE_SIZE_8KB >> config CPU_N10 >> bool "AndesCore N10" >> select CPU_CACHE_NONALIASING if ANDES_PAGE_SIZE_8KB >> config CPU_D15 >> bool "AndesCore D15" >> select CPU_CACHE_NONALIASING >> select HWZOL >> config CPU_D10 >> bool "AndesCore D10" >> select CPU_CACHE_NONALIASING if ANDES_PAGE_SIZE_8KB >> endchoice > > With a 'choice' statement this works, but I would consider that > suboptimal for another reason: now you cannot build a kernel that > works on e.g. both N13 and N15. > > This is what we had on ARM a long time ago and on MIPS not so long > ago, but it's really a burden for testing and distribution once you get > support for more than a handful of machines supported in the mainline > kernel: If each CPU core is mutually incompatible with the other ones, > this means you likely end up having one defconfig per CPU core, > or even one defconfig per SoC or board. > > I would always try to get the largest amount of hardware to work > in the same kernel concurrently. > > One way of of this would be to define the "CPU type" as the minimum > supported CPU, e.g. selecting D15 would result in a kernel that > only works on D15, while selecting N15 would work on both N15 and > D15, and selecting D10 would work on both D10 and D15. > Hi, Arnd: Maybe we should keep the original implementation for this reason. The default value of CPU_CACHE_NONALIASING and ANDES_PAGE_SIZE_8KB is available for all CPU types for now. User can use these configs built kernel to boot on almost all nds32 CPUs. It might be a little bit weird if we config CPU_N10 but run on a N13 CPU. This might confuse our users. From 1585404809534125479@xxx Wed Nov 29 12:50:47 +0000 2017 X-GM-THRID: 1585224361841060243 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread