From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ed1-f74.google.com (mail-ed1-f74.google.com [209.85.208.74]) (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 5AD7837A496 for ; Mon, 22 Jun 2026 11:12:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.74 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782126741; cv=none; b=Ole7d5dKdAt2JvsPI9p3ountvRDNPoSGbsCPvkDUKmf86hcZLeUJ8ok2aC2GbclLIBNB+pPulFfpgb9X3ogJYDTGqHSmX2bGhMlJuG5L88jLtfMHeSA5Rx/vxoCCRg7gPhignnBv4dtmNoI4fLhQsXnma4FUMkIJAmdJxBQF4qM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782126741; c=relaxed/simple; bh=Z/WV+6eQJTf7mvvJFSfzxR+KQCT22p+05SG+LQgnOP4=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=JpW5si7CFGrOO34TZT3413RR5ybHW7xmMXUlA1PgAfap+ujLitn0SW7eEHUBShTsh0CRD84SBelzbFQraIDITl2AAr4xTs1iMViCdsoQ0Vb3tEomiRFvr+BNon1GGSkw3rwmCrKYMtAUPSgxWdNt7E+so40YWAjftmrLho3qzeo= 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=VRM4+qsO; arc=none smtp.client-ip=209.85.208.74 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="VRM4+qsO" Received: by mail-ed1-f74.google.com with SMTP id 4fb4d7f45d1cf-695bbac451bso4553974a12.1 for ; Mon, 22 Jun 2026 04:12:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1782126739; x=1782731539; 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=W0tMHlxfhNRj9OWJ2aLcf95z6Lv7ns1VwKEy9Zm5rfk=; b=VRM4+qsOPpg4sU6oVWJzZiVkg17eiN9XGkxnHnbJ0/AHbvfBi0u1HKEbrsdc7P8LmO F3Pb8GPuCaLFLZ1bT5ZIp3gwuXTpNLOp25oaNcmhhwFebpAPke26vKMJOgP1a7opdzpe 5KDxsyaD/WHcS3DQ3/RFXDaQ4dheLJY6bh6Sgsttnzfhzz9/6LPiZlNgyD0ORPTQDNR5 RH6Q9XAza1dJOp2jRd5qW8PMqpXKDaNI4JPZZp13renvooO+yt01/R9AAD/owdbYdvms DB6QoOTa6r9y+Y8B/rwnaTOJNLf7q9GaaG2tsKa7rqTUxNHVRFBh/wW6uv7+0glOEsV/ 0Lbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782126739; x=1782731539; 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=W0tMHlxfhNRj9OWJ2aLcf95z6Lv7ns1VwKEy9Zm5rfk=; b=RJHQWlb2OW0QxhZBl8zwDYdGu9LlY6+aKJ13zOPqFU22b7jx/zjh0tyA+csKL4DhY1 2in806KfYYBhPWwIT7UBToo7tJY2uhSHWgOxKZAfp3cOkn5HCKaAuKRE/h/ghE3M85mU kXhVW8gWa5XfPdzGp0kqvzHTO5zYNZrJVrfdh5uBsPgZILzvD8atRAylW1QJso/K+s4e XZ+67BmrqIG47OYIqfIk4ExQaeYmY7RVo7K3QZHrnOjtdFTd3SYwpzjam0TBexlUnxUH RmejWXZpXpVtXbR0D9VX/cOQpJGJRHA7fMLcwbaVFPIGEf6rFUAOWR9zgD41ifaIo6q5 4EGA== X-Gm-Message-State: AOJu0YwB+ev7bZH0FQB6T2eo5Y0O0NXQs+2Iga5IIvibZcyV/+LVN4hW qz6KWcFrnt4k6fIU65/RGJoWPIkqsycgawOYepkf33l+WNp3rcvrN6XL8/E8U/45CEyRPsDg0hD pkpH2pyCPNAQFtNo38Q== X-Received: from edti7.prod.google.com ([2002:aa7:c9c7:0:b0:695:8ee5:960f]) (user=tarunsahu job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6402:a295:10b0:697:6415:1186 with SMTP id 4fb4d7f45d1cf-697641513cfmr3638026a12.26.1782126738554; Mon, 22 Jun 2026 04:12:18 -0700 (PDT) Date: Mon, 22 Jun 2026 11:12:14 +0000 In-Reply-To: <20260622111215.4157974-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: <20260622111215.4157974-1-tarunsahu@google.com> X-Mailer: git-send-email 2.55.0.rc0.738.g0c8ab3ebcc-goog Message-ID: <20260622111215.4157974-2-tarunsahu@google.com> Subject: [RESEND PATCH v3 1/2] kho: add KHOSER_COPY_TYPE(UN)SAFE for phys copy From: Tarun Sahu To: Andrew Morton , Pasha Tatashin , Alexander Graf , Pratyush Yadav , Mike Rapoport Cc: linux-kernel@vger.kernel.org, kexec@lists.infradead.org, linux-mm@kvack.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 | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/include/linux/kho/abi/kexec_handover.h b/include/linux/kho/abi/kexec_handover.h index 5e2eb8519bda..618408fbe9c9 100644 --- a/include/linux/kho/abi/kexec_handover.h +++ b/include/linux/kho/abi/kexec_handover.h @@ -139,6 +139,18 @@ (typeof((s).ptr))((s).phys ? phys_to_virt((s).phys) : NULL); \ }) +/* Copies one serializable pointer to another of same type. */ +#define KHOSER_COPY_TYPESAFE(dest, src) \ + ({ \ + typecheck(typeof((dest).ptr), (src).ptr); \ + (dest).phys = (src).phys; \ + }) + +/* Copies one serializable pointer to another. */ +#define KHOSER_COPY_TYPEUNSAFE(dest, src) \ + ({ \ + (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.738.g0c8ab3ebcc-goog