Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp307408pxy; Wed, 21 Apr 2021 03:36:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzToaId2xABmkNt7nHF9JZERDWRxeCU4TJDWr0AMAiEZycw+r5mVCSiZ/XwLgMqeCX0N/mm X-Received: by 2002:a05:6402:350e:: with SMTP id b14mr8515352edd.307.1619001361336; Wed, 21 Apr 2021 03:36:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619001361; cv=none; d=google.com; s=arc-20160816; b=mgMl+Lt7CtaZp+/JEz8USSSM+JJEBK7b4G2cInPrzg6uCnrDtMDgdL7JSeyIsZQzcr NezTkvzjNI7Ldi0dHQSnwVJTInYwrmM6Sid3URZ/emLBVVpBwH9WOECWbFTSiQzPxx5Q KFaTu24x2av0tkgbGGJU4YSuNtrSgrjT9+q9l1oEBayp7A2otoni7cdsbVdjHx099vUE Cp0yhTtx48qdZEfK2uGdw9hmDE6M5cMoUNGNHrhGA6rzN7KqOFPiPzPI1OJISalhi7PX lTMNcfCMghbcqB0r1Ddy4C2OlibgZfDO2MRkn4tj3FW9FUgZ9X5DDFxujYMobxSgwHZE WDOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from; bh=18ruHON27oR+kY/c3N8I4MzJXO+YsiN8w2GDZFpsARM=; b=qVf2Rn/gFHfYg6NbWvucXgj1fkWyEqcOP7vmGbzxhga7B+UzKNuNdbIxFsqq5/GFXf VJaNZGlX2eLMlV34HahepNMNAOYU0mXl0K1vZ19FLoFTdnvKS9jg5KeAdTsSdeKoB6DK 9QxfA7EF+a0qN42O/URUnXqg04LngElAUSC2zq8a52aCFRLMcjSR+UTq26Jdz3Bin1iw ZJcFHUL/zd++DJYJTkW+BkjAE+NxXEvh0gPKbllYUA6oy/2CAzYMVgXeo9vgJjC/8lxd /iOJCJM5fvP+bwenPKmpNaMeOq6kK+9VStUh5124eNXbzVk1/rO78X8PoWRL3VXcVdR7 6SLw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bs7si1643095edb.489.2021.04.21.03.35.38; Wed, 21 Apr 2021 03:36:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239383AbhDUK2B (ORCPT + 99 others); Wed, 21 Apr 2021 06:28:01 -0400 Received: from mx2.suse.de ([195.135.220.15]:38234 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239238AbhDUK1n (ORCPT ); Wed, 21 Apr 2021 06:27:43 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 9D0DDB2F9; Wed, 21 Apr 2021 10:27:09 +0000 (UTC) From: Oscar Salvador To: Andrew Morton Cc: David Hildenbrand , Michal Hocko , Anshuman Khandual , Vlastimil Babka , Pavel Tatashin , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Oscar Salvador Subject: [PATCH v10 5/8] acpi,memhotplug: Enable MHP_MEMMAP_ON_MEMORY when supported Date: Wed, 21 Apr 2021 12:26:58 +0200 Message-Id: <20210421102701.25051-6-osalvador@suse.de> X-Mailer: git-send-email 2.13.7 In-Reply-To: <20210421102701.25051-1-osalvador@suse.de> References: <20210421102701.25051-1-osalvador@suse.de> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Let the caller check whether it can pass MHP_MEMMAP_ON_MEMORY by checking mhp_supports_memmap_on_memory(). MHP_MEMMAP_ON_MEMORY can only be set in case ARCH_MHP_MEMMAP_ON_MEMORY_ENABLE is enabled, the architecture supports altmap, and the range to be added spans a single memory block. Signed-off-by: Oscar Salvador Reviewed-by: David Hildenbrand Acked-by: Michal Hocko --- drivers/acpi/acpi_memhotplug.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/acpi/acpi_memhotplug.c b/drivers/acpi/acpi_memhotplug.c index b02fd51e5589..8cc195c4c861 100644 --- a/drivers/acpi/acpi_memhotplug.c +++ b/drivers/acpi/acpi_memhotplug.c @@ -171,6 +171,7 @@ static int acpi_memory_enable_device(struct acpi_memory_device *mem_device) acpi_handle handle = mem_device->device->handle; int result, num_enabled = 0; struct acpi_memory_info *info; + mhp_t mhp_flags = MHP_NONE; int node; node = acpi_get_node(handle); @@ -194,8 +195,10 @@ static int acpi_memory_enable_device(struct acpi_memory_device *mem_device) if (node < 0) node = memory_add_physaddr_to_nid(info->start_addr); + if (mhp_supports_memmap_on_memory(info->length)) + mhp_flags |= MHP_MEMMAP_ON_MEMORY; result = __add_memory(node, info->start_addr, info->length, - MHP_NONE); + mhp_flags); /* * If the memory block has been used by the kernel, add_memory() -- 2.16.3