sync with OpenBSD -current

This commit is contained in:
purplerain 2024-03-12 06:37:44 +00:00
parent 3d86e50ab8
commit cd0f69e643
Signed by: purplerain
GPG Key ID: F42C07F07E2E35B7
5 changed files with 101 additions and 23 deletions

View File

@ -1,4 +1,4 @@
/* $OpenBSD: vmm_machdep.c,v 1.20 2024/02/29 16:10:52 guenther Exp $ */
/* $OpenBSD: vmm_machdep.c,v 1.21 2024/03/12 02:31:15 guenther Exp $ */
/*
* Copyright (c) 2014 Mike Larkin <mlarkin@openbsd.org>
*
@ -6017,6 +6017,58 @@ svm_handle_msr(struct vcpu *vcpu)
return (0);
}
/* Handle cpuid(0xd) and its subleafs */
static void
vmm_handle_cpuid_0xd(struct vcpu *vcpu, uint32_t subleaf, uint64_t *rax,
uint32_t eax, uint32_t ebx, uint32_t ecx, uint32_t edx)
{
if (subleaf == 0) {
/*
* CPUID(0xd.0) depends on the value in XCR0 and MSR_XSS. If
* the guest XCR0 isn't the same as the host then set it, redo
* the CPUID, and restore it.
*/
uint64_t xcr0 = vcpu->vc_gueststate.vg_xcr0;
/*
* "ecx enumerates the size required ... for an area
* containing all the ... components supported by this
* processor"
* "ebx enumerates the size required ... for an area
* containing all the ... components corresponding to bits
* currently set in xcr0"
* So: since the VMM 'processor' is what our base kernel uses,
* the VMM ecx is our ebx
*/
ecx = ebx;
if (xcr0 != (xsave_mask & XFEATURE_XCR0_MASK)) {
uint32_t dummy;
xsetbv(0, xcr0);
CPUID_LEAF(0xd, subleaf, eax, ebx, dummy, edx);
xsetbv(0, xsave_mask & XFEATURE_XCR0_MASK);
}
eax = xsave_mask & XFEATURE_XCR0_MASK;
edx = (xsave_mask & XFEATURE_XCR0_MASK) >> 32;
} else if (subleaf == 1) {
/* mask out XSAVEC, XSAVES, and XFD support */
eax &= XSAVE_XSAVEOPT | XSAVE_XGETBV1;
ebx = 0; /* no xsavec or xsaves for now */
ecx = edx = 0; /* no xsaves for now */
} else if (subleaf >= 63 ||
((1ULL << subleaf) & xsave_mask & XFEATURE_XCR0_MASK) == 0) {
/* disclaim subleaves of features we don't expose */
eax = ebx = ecx = edx = 0;
} else {
/* disclaim compressed alignment or xfd support */
ecx = 0;
}
*rax = eax;
vcpu->vc_gueststate.vg_rbx = ebx;
vcpu->vc_gueststate.vg_rcx = ecx;
vcpu->vc_gueststate.vg_rdx = edx;
}
/*
* vmm_handle_cpuid
*
@ -6227,22 +6279,7 @@ vmm_handle_cpuid(struct vcpu *vcpu)
*rdx = 0;
break;
case 0x0d: /* Processor ext. state information */
if (subleaf == 0) {
*rax = xsave_mask;
*rbx = ebx;
*rcx = ecx;
*rdx = edx;
} else if (subleaf == 1) {
*rax = 0;
*rbx = 0;
*rcx = 0;
*rdx = 0;
} else {
*rax = eax;
*rbx = ebx;
*rcx = ecx;
*rdx = edx;
}
vmm_handle_cpuid_0xd(vcpu, subleaf, rax, eax, ebx, ecx, edx);
break;
case 0x0f: /* QoS info (not supported) */
DPRINTF("%s: function 0x0f (QoS info) not supported\n",

View File

@ -1,6 +1,6 @@
#!/bin/sh -
#
# $OpenBSD: newvers.sh,v 1.202 2024/02/29 17:05:10 deraadt Exp $
# $OpenBSD: newvers.sh,v 1.203 2024/03/12 01:20:30 deraadt Exp $
# $NetBSD: newvers.sh,v 1.17.2.1 1995/10/12 05:17:11 jtc Exp $
#
# Copyright (c) 1984, 1986, 1990, 1993
@ -71,10 +71,10 @@ ost="SecBSD"
osr="1.5"
cat >vers.c <<eof
#define STATUS "" /* release */
#if 0
#define STATUS "-beta" /* just before a release */
#define STATUS "-current" /* just after a release */
#if 0
#define STATUS "" /* release */
#define STATUS "-beta" /* just before a release */
#define STATUS "-stable" /* stable branch */
#endif

View File

@ -66,6 +66,8 @@ static void apply_edid_quirks(struct edid *edid, struct dc_edid_caps *edid_caps)
/* Workaround for some monitors that do not clear DPCD 0x317 if FreeSync is unsupported */
case drm_edid_encode_panel_id('A', 'U', 'O', 0xA7AB):
case drm_edid_encode_panel_id('A', 'U', 'O', 0xE69B):
case drm_edid_encode_panel_id('B', 'O', 'E', 0x092A):
case drm_edid_encode_panel_id('L', 'G', 'D', 0x06D1):
DRM_DEBUG_DRIVER("Clearing DPCD 0x317 on monitor with panel id %X\n", panel_id);
edid_caps->panel_patch.remove_sink_ext_caps = true;
break;
@ -119,6 +121,8 @@ enum dc_edid_status dm_helpers_parse_edid_caps(
edid_caps->edid_hdmi = connector->display_info.is_hdmi;
apply_edid_quirks(edid_buf, edid_caps);
sad_count = drm_edid_to_sad((struct edid *) edid->raw_edid, &sads);
if (sad_count <= 0)
return result;
@ -145,8 +149,6 @@ enum dc_edid_status dm_helpers_parse_edid_caps(
else
edid_caps->speaker_flags = DEFAULT_SPEAKER_LOCATION;
apply_edid_quirks(edid_buf, edid_caps);
kfree(sads);
kfree(sadb);

View File

@ -6925,6 +6925,23 @@ static int si_dpm_enable(struct amdgpu_device *adev)
return 0;
}
static int si_set_temperature_range(struct amdgpu_device *adev)
{
int ret;
ret = si_thermal_enable_alert(adev, false);
if (ret)
return ret;
ret = si_thermal_set_temperature_range(adev, R600_TEMP_RANGE_MIN, R600_TEMP_RANGE_MAX);
if (ret)
return ret;
ret = si_thermal_enable_alert(adev, true);
if (ret)
return ret;
return ret;
}
static void si_dpm_disable(struct amdgpu_device *adev)
{
struct rv7xx_power_info *pi = rv770_get_pi(adev);
@ -7608,6 +7625,18 @@ static int si_dpm_process_interrupt(struct amdgpu_device *adev,
static int si_dpm_late_init(void *handle)
{
int ret;
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
if (!adev->pm.dpm_enabled)
return 0;
ret = si_set_temperature_range(adev);
if (ret)
return ret;
#if 0 //TODO ?
si_dpm_powergate_uvd(adev, true);
#endif
return 0;
}

View File

@ -342,6 +342,7 @@ alloc_range_bias(struct drm_buddy *mm,
u64 start, u64 end,
unsigned int order)
{
u64 req_size = mm->chunk_size << order;
struct drm_buddy_block *block;
struct drm_buddy_block *buddy;
DRM_LIST_HEAD(dfs);
@ -377,6 +378,15 @@ alloc_range_bias(struct drm_buddy *mm,
if (drm_buddy_block_is_allocated(block))
continue;
if (block_start < start || block_end > end) {
u64 adjusted_start = max(block_start, start);
u64 adjusted_end = min(block_end, end);
if (round_down(adjusted_end + 1, req_size) <=
round_up(adjusted_start, req_size))
continue;
}
if (contains(start, end, block_start, block_end) &&
order == drm_buddy_block_order(block)) {
/*