From patchwork Thu Jan 3 01:10:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 154694 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp143350ljp; Wed, 2 Jan 2019 17:12:04 -0800 (PST) X-Google-Smtp-Source: AFSGD/UetCjo6uNscSy6O/OiFNxtl47r59XNWX7jUdn4SB+zGU3U+uA5p1ZSejLrUYaVgFVIuzl2 X-Received: by 2002:a62:da5a:: with SMTP id w26mr46494783pfl.106.1546477924450; Wed, 02 Jan 2019 17:12:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546477924; cv=none; d=google.com; s=arc-20160816; b=UPsF+jzMroFuYkPjKZKxARJB+e5J05NyphlV79ifUTySUpkfTiVoWaavdUhHs76Hyx DDemnoTYA8QJbcnOxAykVt8wD/Y94L+/xrnMlgtS5uqBBMPSMcJkN5jB8IIYwf58Lt4x VVm4JtZJFQt+S257iQpDzEcHFSXOvNupj6QkJJSh3dGNkd+Uaxe7wdI+/HNb+MeTc6Vk Oy36scwhbxO9yWSy++QkF+JYYGbOTIsAM+CDocxe6yLabX09l+asSxxGsFJ91aTjg7UV xyzC/8Q0rDNhqa+wBuP0YV08DZ6NquvTpFJhGBfjH4xofQjJSSRL/pd3GCUsR9PYxU6U VuqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter; bh=5KRWRSHIDRxrnZsMIZJIuc7XWYwM/TDPLNAwLYwx6tY=; b=g6pK5CjKZzOynYOx90aYYSOY83TGwgYJc9R9h+0o8DWQEnbPcT0J7BPGF0jRI3nzOF O7MiPaau7C2Znv5JR60uT900L/KVDJlTiBmm0kj2lxR1hkkQAQI+daYWRWaKAbSFXRsw 6QsoODPZtxMu//tQP2qj1LzQnJwCb0SEQZwqIXDaN7JtORfnTqLItbmdogRBikTSB70m 8gUzxMt2zTCpTRyMX8U6nKXkZegOcH0h+Z8J1A1jkOGYLOoLxUpxMSZAWxDD2sNLkoKC X2MCmmwuoVLampT8NMzezffawJ4m3hgWvK24PnoT9B+4H2+lfwgtdf12Nob7eQHv+Uyh 34xw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=UurVH6gS; 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 o22si51412280pgb.584.2019.01.02.17.12.04; Wed, 02 Jan 2019 17:12:04 -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=@nifty.com header.s=dec2015msa header.b=UurVH6gS; 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 S1729719AbfACBLl (ORCPT + 31 others); Wed, 2 Jan 2019 20:11:41 -0500 Received: from conuserg-10.nifty.com ([210.131.2.77]:24316 "EHLO conuserg-10.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729232AbfACBLc (ORCPT ); Wed, 2 Jan 2019 20:11:32 -0500 Received: from grover.tkatk1.zaq.ne.jp (zaqdadce369.zaq.ne.jp [218.220.227.105]) (authenticated) by conuserg-10.nifty.com with ESMTP id x031Apkf032182; Thu, 3 Jan 2019 10:10:53 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-10.nifty.com x031Apkf032182 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1546477853; bh=5KRWRSHIDRxrnZsMIZJIuc7XWYwM/TDPLNAwLYwx6tY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UurVH6gSAHW0nUkhyjjPP+5FP6S9eZSubbxbmg42BGOGVlzkNVRCevz6gHR5sfEEm AeKN/r9Gpf8lj+9ZrmYo7Z400axQmMS39mNJcZDA5aIEaK/QQ1SNe9WOBUrKHptv3e sWvjjOWv0mAiZb9qkObkrbVPt0SIMBZIKzdlisIcl+TpLQMr7+oBUCFx2azphXF3Kv CYUL5YWsDfax+UXPQWzf8DPiqykc3zKS3yQdQzxlOUTQoSF4pcQXw0syhKUn0QMFJ9 +GlocK9DKWtXI84geU14jMBNtPs1HloFEfgAPAX1O7nXWHilzy/KVxjOCfF6+tFU18 PXtUJxGdf+dWA== X-Nifty-SrcIP: [218.220.227.105] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-riscv@lists.infradead.org, Masahiro Yamada Subject: [PATCH 3/5] kbuild: generate asm-generic wrappers if mandatory headers are missing Date: Thu, 3 Jan 2019 10:10:38 +0900 Message-Id: <1546477840-14278-3-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1546477840-14278-1-git-send-email-yamada.masahiro@socionext.com> References: <1546477840-14278-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Some time ago, Sam pointed out a certain degree of overwrap between generic-y and mandatory-y. (https://lkml.org/lkml/2017/7/10/121) I tweaked the meaning of mandatory-y a little bit; now it defines the minimum set of ASM headers that all architectures must have. If arch does not have specific implementation of a mandatory header, Kbuild will let it fallback to the asm-generic one by automatically generating a wrapper. This will allow to drop lots of redundant generic-y defines. Previously, "mandatory" was used in the context of UAPI, but I guess this can be extended to kernel space ASM headers. Suggested-by: Sam Ravnborg Signed-off-by: Masahiro Yamada Acked-by: Sam Ravnborg --- Changes in v2: - Filter-out $(generiated-y) from $(mandatory-y) because ARCH may generate mandatory headers by other means Documentation/kbuild/makefiles.txt | 9 ++++++--- scripts/Makefile.asm-generic | 4 ++++ scripts/Makefile.headersinst | 7 ------- 3 files changed, 10 insertions(+), 10 deletions(-) -- 2.7.4 diff --git a/Documentation/kbuild/makefiles.txt b/Documentation/kbuild/makefiles.txt index 8da26c6..bf28c47 100644 --- a/Documentation/kbuild/makefiles.txt +++ b/Documentation/kbuild/makefiles.txt @@ -1296,9 +1296,12 @@ See subsequent chapter for the syntax of the Kbuild file. --- 7.4 mandatory-y - mandatory-y is essentially used by include/uapi/asm-generic/Kbuild.asm - to define the minimum set of headers that must be exported in - include/asm. + mandatory-y is essentially used by include/(uapi/)asm-generic/Kbuild.asm + to define the minimum set of ASM headers that all architectures must have. + + This works like optional generic-y. If a mandatory header is missing + in arch/$(ARCH)/include/(uapi/)/asm, Kbuild will automatically generate + a wrapper of the asm-generic one. The convention is to list one subdir per line and preferably in alphabetic order. diff --git a/scripts/Makefile.asm-generic b/scripts/Makefile.asm-generic index 760323e..a62d282 100644 --- a/scripts/Makefile.asm-generic +++ b/scripts/Makefile.asm-generic @@ -14,6 +14,10 @@ src := $(subst /generated,,$(obj)) include scripts/Kbuild.include +# If arch does not implement mandatory headers, fallback to asm-generic ones. +mandatory-y := $(filter-out $(generated-y), $(mandatory-y)) +generic-y += $(foreach f, $(mandatory-y), $(if $(wildcard $(srctree)/$(src)/$(f)),,$(f))) + generic-y := $(addprefix $(obj)/, $(generic-y)) generated-y := $(addprefix $(obj)/, $(generated-y)) diff --git a/scripts/Makefile.headersinst b/scripts/Makefile.headersinst index 45927fc..3d1ebaa 100644 --- a/scripts/Makefile.headersinst +++ b/scripts/Makefile.headersinst @@ -56,13 +56,6 @@ check-file := $(installdir)/.check all-files := $(header-files) $(genhdr-files) output-files := $(addprefix $(installdir)/, $(all-files)) -ifneq ($(mandatory-y),) -missing := $(filter-out $(all-files),$(mandatory-y)) -ifneq ($(missing),) -$(error Some mandatory headers ($(missing)) are missing in $(obj)) -endif -endif - # Work out what needs to be removed oldheaders := $(patsubst $(installdir)/%,%,$(wildcard $(installdir)/*.h)) unwanted := $(filter-out $(all-files),$(oldheaders))