From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ed1-f73.google.com (mail-ed1-f73.google.com [209.85.208.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 627B063CB for ; Sun, 28 Jun 2026 00:11:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.73 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782605481; cv=none; b=Q1nZru1aA0/md423LULjy4Znt5EfxYe7k7tHm4lucs+hlyHiIpv6524KT+GvW3XwVO3iyYPDnMQ6zhEuCoJYG0x9ePhgQea0P5OJPBtBvqtUMpa5Q6evHzLwajEQ8qTOeT22PpMTyIwB69Au2JTreNtaAmG/E+n2BgYpD3OUQgg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782605481; c=relaxed/simple; bh=qLamSKKDcV1Qxhk9R0PsZ9AeWiUI9xfJJ8YDyD1CAq8=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=u+M/5hKgMRI3lRvYxyQNaWRHegCkqhHqwBnujxwNRt+/gUn2rl9zT+yJSeAc5kFu3bKP90K8hk+luko93KBQvR5f5bQEk/W4OlwvK+4486pSNu33MWkxIsbYCOtr4hY0iBJlrX2NNpOVuolgxRnsx9pIjIojxWVF6dZa4yI+uQM= 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=HsPVzROB; arc=none smtp.client-ip=209.85.208.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="HsPVzROB" Received: by mail-ed1-f73.google.com with SMTP id 4fb4d7f45d1cf-6983e9f38e6so752095a12.0 for ; Sat, 27 Jun 2026 17:11:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1782605479; x=1783210279; 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=R1hMKkHTx9eCvHpWXu0wJEWn2SvHnzVGjd97/dJhuHc=; b=HsPVzROBapsqAwxFVWtpxTf43MJMIhi3sJaSw6FzvBqC1jnzKjxkH+PYA082LIHD5q qwkfH546StQZ3YUwjgS3ruzR283KoHKD3BJmbwYxA9fRrWpFjNxmQjMP7OyfZbNKiueP cRCRVIaptlXv5YzLTX2pPD3kdcW3XbLsGQQAY64KFblyIcnX5/9LptEUdyRhVxMLhGXR cN8BP3d5yA7pw5xxs+T7lG2zTE+L1fg4mJdBrAWeQ6nDfhUcIH/BVzRuPpO3EZCCeaU7 Dyz7s5V9RXo9pWIGjjfWHGL1x+NlwEF07RoAiDW3AHpWEe3GOPzudbAv+nLGuxok1MVz qzmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782605479; x=1783210279; 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=R1hMKkHTx9eCvHpWXu0wJEWn2SvHnzVGjd97/dJhuHc=; b=NOf5zQaJ/4KcrHZjODLx3D2rbIz6zI7BUtA8KLdUXd9X/bmNfife6jk3uv8VxPiJvZ W1ctQl3O6SR602sLX7tCw+2JX+OLMJPvpagS/bfGo8kHzdKG5lnJ9sVu2hM/n/0rA0oZ SZvxGvU6NlMYBk6OLJp2Xu8EW8mRtOk5bBInPGmodL57pOpkHQGnYb2/4+FAfRT1Pl+x i/xt3tWq6gCSusREdcjIptug2hIEw0233O4xjwoJ3nzEPxLwYIK+zGlYLNKlFYFHX+K4 H9KKQwW0j47OMueX9WFeqZD9xqvzZxFjUBOgLa/VYbYLDmLbu5bkjlLyfupjpr3Ynx8Y s/0g== X-Forwarded-Encrypted: i=1; AHgh+RoIPI5dIBkDjVMtXDZBCqZ9DhUq+SUFOgqPNR9GHbGaYAZsRt+B+kw2J7zroRThAMGuIePrOcg0c0hTFXg=@vger.kernel.org X-Gm-Message-State: AOJu0YxNmqERDS6vie18nWHoWnzu9lJh+9iQOqI5fYeutNxHQBDnYPnC k3OlVmopga6u2I6K7oHCems5VY4cWdIfK/PiiHNRfJFxDE4ut9w0uYHYk1wYZRunFpy3ItCqMd1 IUMAYon1qz+Yhl+Sw6Q== X-Received: from edbbf28.prod.google.com ([2002:a05:6402:1a5c:b0:698:48be:f3ac]) (user=tarunsahu job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6402:3591:b0:698:4831:f9aa with SMTP id 4fb4d7f45d1cf-6984831fc61mr973106a12.12.1782605478597; Sat, 27 Jun 2026 17:11:18 -0700 (PDT) Date: Sun, 28 Jun 2026 00:11:13 +0000 In-Reply-To: <20260628001114.1869564-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: <20260628001114.1869564-1-tarunsahu@google.com> X-Mailer: git-send-email 2.55.0.rc0.799.gd6f94ed593-goog Message-ID: <20260628001114.1869564-3-tarunsahu@google.com> Subject: [PATCH v6 2/3] kho: add KHOSER_COPY_PTR to allow phys copy of serialized ptr From: Tarun Sahu To: Pasha Tatashin , Pratyush Yadav , Andrew Morton , linux-mm@kvack.org, Mike Rapoport , Alexander Graf , skhawaja@google.com Cc: kexec@lists.infradead.org, linux-kernel@vger.kernel.org, Tarun Sahu Content-Type: text/plain; charset="UTF-8" Adding KHOSER_COPY_PTR to copy one serializeable pointer to another. It basically allows copy of phys val of the serializeable pointer. It ignores the typecheck if any of the argument is of void * Signed-off-by: Tarun Sahu Reviewed-by: Pratyush Yadav (Google) Reviewed-by: Pasha Tatashin --- 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..a5a518e881fd 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); \ }) +#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.799.gd6f94ed593-goog