From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ej1-f73.google.com (mail-ej1-f73.google.com [209.85.218.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7A04A283FE6 for ; Mon, 22 Jun 2026 22:57:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.73 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782169062; cv=none; b=jTaxjyw8oh7nH33iBF95Czszfk6saehhPlLDQlPUGYnRHJqKYGmJeoSMpnk2xoTFPAb72XLX9rKAR7oiDdgt3Ov6VJ9OJWLu3U9T6KegXvCA3nwZsiV6q8Uq/K32rML1Gi9fAp535antjQ2DoyUULsUvzE+dSHBEuGum790buSU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782169062; c=relaxed/simple; bh=tBjREm+24jnKb8/4pxGy5TbIoJKUFaBuiHt3Hu5PAos=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=qiWTpf+Ib7mColJnWvKPfsb0GT1HLmSNCoFVstKcgUQlxT1rDej0/kKYzXWFDGepA05EELXuI7+o+auCH0bGahuY20XQhXyMG+g+eNPKIhZMEVhtJm4jorcRjFvvxo4cNNKGvNnls0xlwyh+8d4i7cQk2IKv4B96iCfCX1bzal0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--tarunsahu.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=lakgmSRz; arc=none smtp.client-ip=209.85.218.73 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--tarunsahu.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="lakgmSRz" Received: by mail-ej1-f73.google.com with SMTP id a640c23a62f3a-bf5ea9d13f9so563506566b.0 for ; Mon, 22 Jun 2026 15:57:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1782169060; x=1782773860; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=1NOYzLzQAQS0m9MRiDTCQXpcLo3JF92UmgVDsUD8aNE=; b=lakgmSRzySqEdM/mXDSpRQJ0T/azFU8NXqCozTYB8W7llVdEwLTh+qhpG/ykKTse4U wiuqCpAGVgQutu6n0LR70TvbOnoOVKMjR7sm/Vc9sKf0zDn/u+wplAJw4kpACWsD2/MD QrsVdAP9+u/VRoGlVcz/meld5r2vu9SrnbcH3tfFu9FFS7kADXeUkTt+5N3Q5xSPDXWj Y8y/0N8Xh5rtNIhqd2bePuVkEwi4w3mNsn260Pa5yAqCQ28b1SC102unc3qZplFrHkPt CgUZKc1AUJt90+W2pniOs8/55OqH8bu/DLAbQI1zrOh52HhABLDoCkF7Q6A52yIAPv/o MIuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782169060; x=1782773860; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=1NOYzLzQAQS0m9MRiDTCQXpcLo3JF92UmgVDsUD8aNE=; b=jkD56oOZJ8PWhonJoWijU+YgYv59E2JWbM0FL0m7hMgnNcLPn3q5bEyVk3ApVsyfb8 gubFautjQf0C/Bq7uTcFPcgqSt8oJhK8bN519I7Ptt1dVS0YZNF0waAXFFNwGBbnrZ3Q JgKqD0/r8eKnBukszY9cJfRh3W3BjzCOl9EE5kqN8BGBIwa8MX6b5SiQW/87+JIpXMzv q8Cw1Q2fPuQhg6OS/zaZ0wzxo5Bumr+ccs9yr5edkYaK2uE7nc+GWlhJlwS+T3Gxi9B3 UK3jFyeyg5QSlGUxkTNr5+hek0knL97SWhnb71Su2iTtp+F2hFfdYI1zdnFwQaSNhobe 2rMA== X-Forwarded-Encrypted: i=1; AFNElJ+hx9/kx6UZlCg9Zrw1f8KSplbMVWwqj/u1FnFAF98jqtXjJsvD/GA5Ep50u8j1w9meLkVNrIImqRPNdh0=@vger.kernel.org X-Gm-Message-State: AOJu0YzCeya4za+80pMrrSSYM5ZVDza3nzKw8vc6LIIeLUREJKbHmMwv 3qEzCab5NUpMf03pVNZyGGm/DyJ0OfQkqIQpZ126A5O3ogzUWdwR/57quAYVzQo7t7dFCqGiU2G XxmV8b1sPT6OmGx7UQg== X-Received: from ejbla19.prod.google.com ([2002:a17:906:ad93:b0:beb:5fe:489]) (user=tarunsahu job=prod-delivery.src-stubby-dispatcher) by 2002:a17:907:1c97:b0:c0d:2ab6:8055 with SMTP id a640c23a62f3a-c0d2ac5cc8emr526314366b.53.1782169059511; Mon, 22 Jun 2026 15:57:39 -0700 (PDT) Date: Mon, 22 Jun 2026 22:57:35 +0000 In-Reply-To: <20260622225736.2961438-1-tarunsahu@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260622225736.2961438-1-tarunsahu@google.com> X-Mailer: git-send-email 2.55.0.rc0.786.g65d90a0328-goog Message-ID: <20260622225736.2961438-2-tarunsahu@google.com> Subject: [PATCH v4 1/2] kho: add KHOSER_COPY_TYPE(UN)SAFE for phys copy From: Tarun Sahu To: Pasha Tatashin , Mike Rapoport , Pratyush Yadav , Alexander Graf , Andrew Morton Cc: linux-mm@kvack.org, kexec@lists.infradead.org, linux-kernel@vger.kernel.org, Tarun Sahu Content-Type: text/plain; charset="UTF-8" Adding KHOSER_COPY_TYPESAFE and KHOSER_COPY_TYPEUNSAFE to copy one serializeable pointer to another. It basically allows copy of phys val of the serializeable pointer. Signed-off-by: Tarun Sahu --- include/linux/kho/abi/kexec_handover.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/include/linux/kho/abi/kexec_handover.h b/include/linux/kho/abi/kexec_handover.h index 5e2eb8519bda..c1b61d875dcc 100644 --- a/include/linux/kho/abi/kexec_handover.h +++ b/include/linux/kho/abi/kexec_handover.h @@ -139,6 +139,17 @@ (typeof((s).ptr))((s).phys ? phys_to_virt((s).phys) : NULL); \ }) +/* Copies one serializable pointer to another. */ +#define KHOSER_COPY_PTR(dest, src) \ + ({ \ + static_assert( \ + __builtin_types_compatible_p(typeof((dest).ptr), typeof((src).ptr)) || \ + __builtin_types_compatible_p(typeof((dest).ptr), void *) || \ + __builtin_types_compatible_p(typeof((src).ptr), void *), \ + "pointer type mismatch in KHOSER_COPY_PTR" \ + ); \ + (dest).phys = (src).phys; \ + }) /* * This header is embedded at the beginning of each `kho_vmalloc_chunk` * and contains a pointer to the next chunk in the linked list, -- 2.55.0.rc0.786.g65d90a0328-goog