Skip to content

Standardize sev snp policy#4446

Merged
YvanY0 merged 2 commits intoautotest:masterfrom
YvanY0:standardize-sev-snp-policy
Mar 20, 2026
Merged

Standardize sev snp policy#4446
YvanY0 merged 2 commits intoautotest:masterfrom
YvanY0:standardize-sev-snp-policy

Conversation

@YvanY0
Copy link
Copy Markdown
Contributor

@YvanY0 YvanY0 commented Mar 11, 2026

Standardize SNP policy configuration to use vm_sev_policy parameter, providing consistent configuration across all AMD SEV technology variants (SEV → SEV-ES → SEV-SNP). And also Change SEV policy values from decimal to hexadecimal format to align with QEMU and libvirt documentation standards.

ID: 5134

Summary by CodeRabbit

  • Refactor

    • Standardized SEV/SNP policy values to hexadecimal representation and unified policy key naming for consistency across configurations.
    • Simplified test logic to use numeric policy values for comparisons.
  • Bug Fix

    • Introduced a default SEV policy value to avoid missing-parameter issues and ensure deterministic test outcomes.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 11, 2026

Walkthrough

Configuration files switch numeric SEV/SNP policy literals from decimal to hexadecimal and consolidate per-variant SNP policy settings (snp_policy + vm_secure_guest_object_options) into a single vm_sev_policy key. Test code updates read numeric policies via vm.params.get_numeric(...) (one with default 196608 for SNP test, another with default 3 for SEV basic), remove string-based parsing, and compare numeric values against QMP-reported policy fields. No other control flow or behavioral semantics are changed.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly reflects the main change: standardizing SEV/SNP policy configuration and representation across the codebase.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@JinLiul
Copy link
Copy Markdown
Contributor

JinLiul commented Mar 16, 2026

with avocado-framework/avocado-vt#4329
sev and snp test cases passed.

@YvanY0 YvanY0 force-pushed the standardize-sev-snp-policy branch 2 times, most recently from 4fb9f0a to cab3bd5 Compare March 18, 2026 06:27
Comment thread qemu/tests/cfg/snp_attestation.cfg
Yihuang Yu added 2 commits March 20, 2026 11:28
Change SEV policy values from decimal to hexadecimal format (0x prefix)
to align with QEMU and libvirt documentation standards.

Changes:
- sev_basic_config.cfg: 3/4/6/7 → 0x3/0x4/0x6/0x7
- sev_dhcert_boot.cfg: 7 → 0x7
- sev_hotplug_mem.cfg: 7 → 0x7

This standardization improves consistency across all AMD SEV technology
variants and matches official documentation examples.

Signed-off-by: Yihuang Yu <yihyu@redhat.com>
Standardize SNP policy configuration to use vm_sev_policy parameter,
providing consistent configuration across all AMD SEV technology
variants (SEV → SEV-ES → SEV-SNP).

Changes:
- Replace vm_secure_guest_object_options with vm_sev_policy
- Remove intermediate snp_policy variable
- Use params.get_numeric() for cleaner code
- Align with avocado-vt framework design

Reference: avocado-framework/avocado-vt#4329
Signed-off-by: Yihuang Yu <yihyu@redhat.com>
@YvanY0 YvanY0 force-pushed the standardize-sev-snp-policy branch from cab3bd5 to 0c9f727 Compare March 20, 2026 03:29
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
qemu/tests/snp_basic_config.py (1)

70-70: Use a hex literal for default SNP policy for consistency.

At Line 70, consider replacing 196608 with 0x30000 to match the policy-format standardization goal and improve readability.

Proposed consistency tweak
-    vm_policy_int = vm.params.get_numeric("vm_sev_policy", 196608)
+    vm_policy_int = vm.params.get_numeric("vm_sev_policy", 0x30000)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@qemu/tests/snp_basic_config.py` at line 70, Replace the decimal default
literal 196608 used in the vm.params.get_numeric call with a hex literal to
improve readability and consistency; update the call
vm.params.get_numeric("vm_sev_policy", 196608) to use 0x30000 as the default for
vm_policy_int (referencing vm_policy_int, vm.params.get_numeric, and
"vm_sev_policy").
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@qemu/tests/snp_basic_config.py`:
- Line 70: Replace the decimal default literal 196608 used in the
vm.params.get_numeric call with a hex literal to improve readability and
consistency; update the call vm.params.get_numeric("vm_sev_policy", 196608) to
use 0x30000 as the default for vm_policy_int (referencing vm_policy_int,
vm.params.get_numeric, and "vm_sev_policy").

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 37fb7463-be2f-4a99-a67f-1e57aa5aa4c1

📥 Commits

Reviewing files that changed from the base of the PR and between cab3bd5 and 0c9f727.

📒 Files selected for processing (7)
  • qemu/tests/cfg/sev_basic_config.cfg
  • qemu/tests/cfg/sev_dhcert_boot.cfg
  • qemu/tests/cfg/sev_hotplug_mem.cfg
  • qemu/tests/cfg/snp_attestation.cfg
  • qemu/tests/cfg/snp_basic_config.cfg
  • qemu/tests/sev_basic_config.py
  • qemu/tests/snp_basic_config.py
✅ Files skipped from review due to trivial changes (4)
  • qemu/tests/cfg/sev_dhcert_boot.cfg
  • qemu/tests/cfg/sev_basic_config.cfg
  • qemu/tests/sev_basic_config.py
  • qemu/tests/cfg/sev_hotplug_mem.cfg
🚧 Files skipped from review as they are similar to previous changes (2)
  • qemu/tests/cfg/snp_attestation.cfg
  • qemu/tests/cfg/snp_basic_config.cfg

@YvanY0 YvanY0 merged commit 7373b48 into autotest:master Mar 20, 2026
12 checks passed
@YvanY0 YvanY0 deleted the standardize-sev-snp-policy branch March 20, 2026 03:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants