1*70466381SSean Christopherson // SPDX-License-Identifier: GPL-2.0-only 2*70466381SSean Christopherson #include "kvm_util.h" 3*70466381SSean Christopherson 4*70466381SSean Christopherson void ucall(uint64_t cmd, int nargs, ...) 5*70466381SSean Christopherson { 6*70466381SSean Christopherson struct ucall uc = {}; 7*70466381SSean Christopherson va_list va; 8*70466381SSean Christopherson int i; 9*70466381SSean Christopherson 10*70466381SSean Christopherson WRITE_ONCE(uc.cmd, cmd); 11*70466381SSean Christopherson 12*70466381SSean Christopherson nargs = min(nargs, UCALL_MAX_ARGS); 13*70466381SSean Christopherson 14*70466381SSean Christopherson va_start(va, nargs); 15*70466381SSean Christopherson for (i = 0; i < nargs; ++i) 16*70466381SSean Christopherson WRITE_ONCE(uc.args[i], va_arg(va, uint64_t)); 17*70466381SSean Christopherson va_end(va); 18*70466381SSean Christopherson 19*70466381SSean Christopherson ucall_arch_do_ucall((vm_vaddr_t)&uc); 20*70466381SSean Christopherson } 21